Hot answers tagged

15

Open the /Applications/Utilities/Terminal.app and you have a unix prompt. Both perl and cpan ship with OS X so you have nothing to install unless you want a different version of them than ships with your particular version and build of OS X. Air:~ me$ cpan Perl6::Say Sorry, we have to rerun the configuration dialog for CPAN.pm due to some missing ...


9

You might be interested in perlbrew to manage local perl installations and cpan modules without interfering with perl included with the system or needing to use sudo to install cpan modules.


6

I found on another website the following command $ sudo perl -MCPAN -e 'CPAN::Shell->notest(install => CPAN::Shell->r)' This updated all my perl modules and all is back to normal. Not sure why or what, but don't care that it is working now.


4

You can install a newer version of cpan in /usr/local/bin with the following CPAN configuration: cpan cpan> o conf makepl_arg "INSTALLBIN=/usr/local/bin INSTALLSCRIPT=/usr/local/bin" cpan> o conf commit cpan> exit sudo cpan -i CPAN This solution, and others, is discussed at perlmonks.


4

perlbrew You will find installing a local copy of perl, separate from the one bundled with Mac OS X, will make your module installation easier. Use perlbrew to install and manage a specific version of perl. This isolates your perl from OS X updates and changes which have caused multiple problems in the past: curl -L http://install.perlbrew.pl | bash ...


4

You could save the script as ~/Scripts/weasels.sh with any text editor, and run it with bash ~/Scripts/weasels.sh ~/Documents/input\ file.txt. Or if you use TextMate, you can run the script with just ⌘R. If you want to run the script with weasels instead of bash ~/Scripts/weasels.sh, you can make it executable and add its folder to the path: mv ~/Scripts/...


4

You'll need to get the POSIX path of the input file: on run {input, parameters} tell application "Terminal" activate do script "/Users/myaccountname/Applications/TeXcount_3_0/texcount.pl \"" & ( POSIX path of input as string) & "\"" end tell end run I found the answer over at StackOverflow.


4

After quite a bit of frustration, I eventually found a simple solution that works. The salient details are that you need to update the DYLD_LIBRARY_PATH to include /usr/local/mysql/lib. The easiest way of doing that is to add the following to your ~/.bashrc file: export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH" I went into a little more ...


4

Standard binaries are protected by SIP and can‘t easily be removed nor replaced. Booting into recovery and reinstalling macOS only is the easiest way to solve this. You may need to manually reinstall any user-installed CPAN modules again afterwards.


3

I had the same symptoms, but a different problem: perl, by default, runs as 64bit executable, but my mysql installation and hence all its libraries are 32bit only. Forcing perl to run in 32bit mode solved it: defaults write com.apple.versioner.perl Prefer-32-Bit -bool yes


3

A couple ideas: Examine the manifest in the latest High Sierra installer or do a clean install on spare disk and compare it to your system Check the dates on the various directories A couple comments: When I do a 10.x upgrade, i.e from Sierra to High Sierra, I always do a clean install consisting of backing up my home dir, reformatting the drive, then ...


2

There are two minor issues: First, to pipe file names to a perl one-liner in this way, you need to use the xargs command. Second, you will need to pass the full path to the perl one-liner, because it might be in a subdir, so it would be better to use find. Here's a working command: find . -name "*.txt" | xargs perl -i -p -e 's/one.a/two.a/g'


2

Assuming you have access to the file from your Mac system, for example through a shared folder, you would run it locally (through Terminal) like this: perl /path/to/windows/shared/folder/scriptname.pl In AppleScript this would be something like: do shell script "/usr/bin/perl /path/to/windows/shared/folder/scriptname.pl However, this still executes the ...


2

I commented out ipv6 localhost in /etc/hosts to fix this.


2

See decription above. We need Xcode (I use 4.5.1 including the CLI tools which you can download in the preferences tab of Xcode) and Lion (I use 10.7.5 but should work also fine in 10.8). Lynx : cd $HOME mkdir Source cd Source curl -L ftp://gd.tuwien.ac.at/infosys/browsers/lynx//lynx2.8.7/lynx2.8.7.tar.gz -o lynx2.8.7.tar.gz tar -xzvf lynx2.8.7.tar.gz cd ...


1

bsd grep does not use perl regular expressions. Please read man grep and note what the -p option does. Again, man 7 re_format explains how regex works in macOS with tools such as grep and sed. In your regular expression the character \t is not interpreted as the tab control character. So you will need to type the literal tab character ( control + v, tab ) ...


1

RegExPlanet offer a Regular Expression Test Page for Perl. This page works with Safari on macOS 10.12. You may find that grep included with macOS does not include all the functionality you want. If so, try installing grep from Homebrew or MacPorts.


1

See first comment here for answer: http://www.perlmonks.org/?node_id=1191380


1

Most probably you did not do anything harmful. It would be easier to tell if you can remember which CPAN commands, you've entered. It is perfectly normal that the first run of CPAN creates the directories mentioned, downloads various files containing package indexes, etc. It potentially also updates various packages that forms the basis of CPAN itself, as ...


1

Well, after trying other solutions of this and other threads to no avail, I stumbled upon this one-liner that did the trick for me: $ sudo OPENSSL_INCLUDE=/usr/local/opt/openssl/include OPENSSL_LIB=/usr/local/opt/openssl/lib PERL_MM_USE_DEFAULT=1 perl -MCPAN -e "install Crypt::SSLeay"


1

I finally figured it out: I can achieve what I want by using the $ARGV array which holds all arguments that are passed on to the perl script via the command line. In an applescript I can simply put this line: do shell script "perl myscript.pl inputfile outputfile" Assuming inputfile and ouputfile are the (paths to) the files I want to run the perl script ...


1

The maximum length of a command line is 2**18 bytes: $ getconf ARG_MAX 262144 So that for example this results in an error: read "/usr/share/dict/web2" for 270000 do shell script "printf %s " & quoted form of result If the input is short enough, you can pass it to perl as part of the command line: read "/usr/share/dict/web2" for 260000 do shell ...


1

Doing a `cd /path` within your script only changes the directory for the shell that is spawned to execute the shell command. It's the same thing as doing system('cd /path'); It doesn't change the cwd (current working directory) of the script itself. The best way to do it is to have your script write the files to a specific directory. If your perl ...


1

I am using Mac OS X 10.11.3 El Capitan, perlbrew 1.74 installed with cpanm & App::perlbrew/0.74 Perl revision 5 version 22 subversion 1 (installed via perlbrew) DBI -- 1.631 DBD::Oracle VERSION: 1.74 Oracle InstantClient 11.2.0.4.0 installed at /usr/local/lib/oracle/instantclient_11_2 I can confirm that the only way, so far, I have been ...


1

The problem was cpan installed with MacPorts. I had to install the module with $ /usr/bin/cpan -i Crypt::OpenSSL::Bignum, specifying an absolute path for cpan.


1

You're trying to change the ownership to owner "root" and group "lolajl", and "lolajl" isn't a legal group. Instead, try the following: sudo chown lolajl:staff .cpan which will change .cpan to be owned by user "lolajl" and group "staff".


1

The answer to this question is to add .noindex -extension at the end of .bak. Thank you, Tetsujin! I refer this one liner to do it find . -name "*\.tex" -exec bash -c 'mv "{}" "{}.noindex"' \;


1

It seems like you might have cut-n-pasted the command in to the shell in some odd way - or you manually entered it in the wrong way. Try again, and this time pay attention to the quote characters. You need to use the right apostrophes. Make sure you don't use backticks or similar.


1

You can also use quoted form of to escape the arguments: on run {input, parameters} tell application "Terminal" do script "printf %s\\\\n " & quoted form of POSIX path of item 1 of input & ">/tmp/a" end tell end run Or if the service can receive multiple files as input: on run {input, parameters} set args to "" repeat ...


1

The problem has been solved. Basically Apache did not have permission to write into the folder. Steps to solve the issue included: ls -la cgi-bin to check the permissions of my cgi-bin folder. Give the _www group ownership of cgi-bin and give the group write permissions: chgrp -R _www cgi-bin && chmod g+w cgi-bin. In addition, I added my User to the ...


Only top voted, non community-wiki answers of a minimum length are eligible