I'm a Mac newbie and just upgraded to Node.js 0.67. After running node, the installer says "Make sure that /usr/local/bin is in your $PATH."
And I try to run node but as expected, it doesn't run without the path change.
So not really knowing what I'm doing (yes!), after some research I do this:
export "PATH=/usr/local/bin"
And node runs. But sudo doesn't. Which I think means I screwed up the environment variables.
sudo: command not found
Then in another Terminal window (that was open when I messed this up), sudo does respond; both windows have the same path. But in that window, npm is no longer available.
Can anyone help get me back to sudo stability?
sudo on a Macintosh lives in /usr/bin.
Make sure /usr/bin is in your $PATH environment and you should be okay.
And to do that, in the context of your question above, do something like:
export "PATH=$PATH:/usr/local/bin"
The idea here being that you are appending a new search path to the already existing list in your PATH environment variable.
Here is a potentially useful tutorial you can refer to.
Related
I have weird problem as all of the sudden terminal stopped reading any commands. Last weekend I installed Wordpress with PHP and mySQL and since that moment didn't have time to do anything more on laptop. Now I wanted to launch some react-native code but command wasn't found, then I tried different things to use some other commands and each time I get message
MBP-Mateusz-2:business-cards-native mateusz$ code .
-bash: code: command not found
and doesn't matter what command is that except standard ones like ls, cd etc. However when I try to write npm --version, or node --version, or launch visual studio code like before with code ., each time I get command not found. Doesn't anyone have issue like that? How to fix it as I'm super confused and have no idea even where to start.
You probably messed up your PATH environment variable, and now your computer cannot find the commands if you don't tell it directly where. The PATH variable contains the directories where the system should look for binaries if they're not in the current directory. If it gets corrupted for some reason, you won't be able to run any program from the terminal unless you pointed directly its location.
I would first run this command:
echo $PATH
so you can see which is the content of the PATH.
If it seems empty, or some critical folders are missing, try to add them temporarily:
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Then try to run the commands again from the same terminal and see if that worked.
If that works, check if you have a ~/Library/LaunchAgents/environment.plist file and its content. It is possible that there is a key for the PATH and that its values are pointing something of your Wordpress stack but not the system directories.
If that looks fine, look at the ~/.bash_profile file. Find any export PATH instruction that may explain your issues. If you can't find any, but still exporting the PATH worked out, add at the end of the file that instruction as a workaround for fixing the mess:
export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
(notice that I'm ading $PATH in this last case so if there is any other path actually configured it is added as well)
Good luck.
EDIT: That's the usual issue people has, but now that I've read your comments, the issue seems a bit more serious. It looks like the mySQL setup destroyed your /usr/local/ folder, which means you lost all the binaries located there npm, code, etc.
If you have a backup of the whole filesystem (which by experience is unlikely), restore /usr/local folder.
If you don't have any backups, you can reconstruct /usr/local... by reinstalling the software that cannot be found. Reinstall npm, VSCode, etc, that will place their executables again in the /usr/local folders and from there you'll be good to go. Install brew (since it's likely that also got deleted) then try brew install node and see if now you can run npm. If that works out, I'm afraid you'll have to reinstall all the software you lost again.
Previously I was able to start Meteor 0.6.6.3 by simply running mrt.
Recently, Meteor 0.7.0.1 wont run properly unless I run it as root with sudo mrt. Environmental variables like MONGO_URL requires root to set it.
Any ideas what happened? I'm using Mountain Lion on Mac OSX.
You might have run it with sudo once before. When you run it with sudo just once and a file is written the files become root files root user file so it needs more permissions to run and wont run
ordinarily.
You might have run sudo mrt once it must have updated files for a package but they're now owned by root instead of your normal user.
I'm sure theres a terminal command to get it back but using Disk Utility and running 'Repair Disk Permissions' can also fix it (i think).
I am trying to get to install stardog on mac 10.8.5 using the instructions provided at http://docs.stardog.com/quick-start/.
The export path particular directory has been created and for which echo’ed to make sure that environmental variable is set up. The license key that is provided is also in the correct directory. When I try to run “$ ./stardog-admin server start” the command is not recognized. So I tried to create an export PATH to stardog’s bin, which did not work either.
I have also tried manually adding the path in the following:
- ~/.bash_profile
- ~/.profile
Still no luck, any ideas?
Using zsh I had a similar problem. For some reason, the docs suggest that from the stardog-directory-name directory you can run the command, but it didn't work until you cd into the bin directory. Once there ./stardog-admin server start should run correctly.
It sounds like you simply have something incorrect in your .bash_profile or .profile. If you run either of the stardog scripts from it's bin directory, it will work. If you're getting a command not recognized error, that sounds like bash cannot find the stardog-admin script.
I have downloaded and opened postgres.app
According to their docs, I should now be able to run which psql. In the terminal. This renders nothing. I'm running mavericks. How can I debug this problem or solve it?
Check your PATH and make sure it includes the folder where the psql program exists.
If not, add it to your bash profile:
PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
http://postgresapp.com/documentation
I recently installed Jenkins, using Homebrew. I also installed Mercurial using Homebrew.
I can successfully clone an hg repo just fine - from Terminal. But if I try and do the same thing as part of a job in Jenkins, it fails.
So, in by job, I told Jenkins to run a shell script echo $PATH. Sure enough, the path /usr/local/bin is not there. If I execute the same command from Terminal, it's there.
So, what is the best way to modify PATH so that Jenkins is pulling the same PATH that I'm using, when I echo it from Terminal?
Note, Jenkins is running from the same user account that I'm logged into doing these tests, so I can't fathom why this is happening.
In your launchd .plist file for Jenkins, you can set the PATH environment variable by using the following:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>(insert your path value here)</string>
</dict>
That should set the PATH to whatever you need.
For some reason, Jenkins doesn't keep /usr/local/bin in the PATH when connecting to a slave.
You can add it to the PATH either by
Adding an environment variable on the Node Configuration, or
Adding a .bashrc file on the user folder with
PATH="/usr/local/bin:${PATH}"
Note: The Mac client must be disconnected and then reconnected via the Jenkins web app after editing ~/.bashrc
I found that even setting the PATH environment variable for the node didn't work for the hombrew Mercurial installation. The path WOULD get set, but only for the script build phase, not for the VCS checkout phase. Here's what I wound up doing.
Go into Manage Jenkins -> Configure System
Add a new Mercurial Installation
Name it whatever you want (I named mine build-mac)
For Installation Directory I put /usr/local
The Executable parameter was pre-set to INSTALLATION/bin/hg, so I just left it at that.
Everything else in here can be left blank
Go into your job and edit the configuration
Under Source Code Management set Mercurial Version to the mercurial installation you just added.
Save
$$$
Hope that helps anyone else running into this same problem, now that we're not allowed (by default anyways) to do anything inside of /usr/bin anymore. Previously I would have just symlinked hg there, but now with the new "System Integrity Protection" "feature", that's no longer as trivial of task, and even more difficult if your Mac slave is headless.
You can set PATH in launchd.conf file. See here for details. Note that man launchctl says that 'commands can be stored in $HOME/.launchd.conf or /etc/launchd.conf to be read at the time launchd starts', so you probably can create '.launchd.conf' in your home directory and use instructions from the link with this file. But as far as I know in launchd.conf file you can't add directory to PATH, you can just rewrite PATH.
You can also see here for the solution using /etc/paths.d directory
There should be no space on either side of = in following PATH modification:
PATH="/usr/local/bin:$PATH"
I added it to my pre-build step on Jenkins installed on macOS.