You're welcome. I quite enjoy the opportunity to help people learn about the command line, as it is very powerful, but it can be very intimidating. The best way to learn is when you have a practical use-case, so this was a good opportunity.
Oh! My bad. I should have explained.
That folder does not exist by default. (The purpose of /usr/local/
is to be things installed by the user, not by Mac OS, so they will not interfere with each other. Basically, MacOS puts things in /usr/bin
and you put things in /usr/local/bin
.)
To create that folder you will need to use the sudo
command which lets you do things as an "administrator" (sort of like you sometimes get asked for your password when installing apps).
These two commands should do what you need. After the first time you use sudo
it will show you a "scary" warning about sudo
which you can read but don't worry about it (the warning is mostly for users in a corporate or school environment where sudo
is probably something they should not use).
You will be prompted for your password. Enter the same password that you use to log in to your account on your Mac:
(after you enter your password, sudo
won't ask for it again for a few minutes, I think about 5… so don't be surprised if it only asks once)
sudo mkdir -p /usr/local/bin/
sudo chown "$USER" /usr/local/bin/
The first command will make a directory (mkdir = 'make directory') at /usr/local/bin/ and will make the "parent" directory /usr/local/ if it does not exist (mkdir -p = "make directory and any others that need to be made"). In this case "local" is the "parent" folder of "bin" in Unix parlance.
Without the -p
you would have to use two separate mkdir
commands:
sudo mkdir /usr/local/
sudo mkdir /usr/local/bin
The second command will "change" the "owner" (ch+own = chown = "change owner") of the folder /usr/local/bin to $USER
which will be replaced with you're username. Try
echo "$USER"
to see what $USER
is on your system.
By default it will be owned by root
as that is the user for anything done by sudo
. But if you want to be able to add things to that folder, you should be the "owner" of it.