make install error - mkdir: /usr/local/lib/rosie: Permission denied
I tried to make install rosie
and this was the output:
bash-3.2$ make install
Installing...
Checking the build using ./rosie
Rosie Pattern Engine 1.3.0 built successfully!
Use 'make install' to install into DESTDIR=/usr/local
Use 'make uninstall' to uninstall from DESTDIR=/usr/local
To run rosie from the build directory, use: ./rosie
Try this example, and look for color text output: ./rosie match all.things test/resolv.conf
rm -f "/usr/local/lib/rosie"
mkdir -p "/usr/local/lib/rosie"
mkdir: /usr/local/lib/rosie: Permission denied
make[1]: *** [installforce] Error 1
make: *** [install] Error 2
I tried to make the directory myself:
bash-3.2$ sudo mkdir -p "/usr/local/lib/rosie"
bash-3.2$ make install
/usr/local/lib/rosie already exists. Run 'make installforce' to overwrite it.
make: *** [install] Error 255
bash-3.2$
Running make installforce didn't help either, I just got lots of Permission denied
/No such file or directory
/unable to copy extended attributes
errors.
Note that ./rosie
does work (with colors):
bash-3.2$ ./rosie match all.things test/resolv.conf
#
# This is an example file, hand-generated for testing rosie.
# Last update: Wed Jun 28 16:58:22 EDT 2017
#
domain abc.aus.example.com
search ibm.com mylocaldomain.myisp.net example.com
nameserver 192.9.201.1
nameserver 192.9.201.2
nameserver fde9:4789:96dd:03bd::1
I am using a fresh install of macOS Monterey 12.6.3 (the latest Monterey). I believe the issue has to do with permissions of the /usr/local
folder. Because
-
sudo make install
worked, and - Installing brew first and trying again also worked.
I'd need to look more closely on their install script to know what exactly they do. This looks like the interesting part in:
bash-3.2$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | grep --color usr/local
# On Intel macOS, this script installs to /usr/local only
HOMEBREW_PREFIX="/usr/local"
bash-3.2$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | grep --color sudo.*HOMEBREW_PREFIX
sudo chmod 775 ${HOMEBREW_PREFIX}
execute_sudo "${INSTALL[@]}" "${HOMEBREW_PREFIX}"
It seems that the only thing needed was sudo chmod 775 /usr/local
(but I have not tried it yet). It might be good to have the Makefile check that /usr/local has appropriate permissions (by seeing whether the mkdir commands fail) and if so instruct the user to run the chmod command and try again (or suggest running sudo make install
, if the user prefers not to mess with the /usr/local
permissions).