MacOS – Changing ownership of .cpan

macosperlpermission

I'm getting back into Perl; several months ago I had to have a new hard drive installed and so had to start over again. When I try to update CPAN, I get this message:

Your configuration suggests that CPAN.pm should use a working
directory of
/Users/lolajl/.cpan
Unfortunately we could not create the lock file
/Users/lolajl/.cpan/.lock
due to 'Permission denied'.

Looking at /Users/lolajl directory, I'm seeing this:

drwxr-xr-x    4 lolajl  staff    136 Nov 27  2014 .config
drwxr-xr-x    8 root    staff    272 Jun 14 20:14 .cpan

When I try to run "sudo chown root:lolajl .cpan", I get:

chown: lolajl: illegal group name

How do I get this corrected so that CPAN can run properly?

Best Answer

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".