Keep getting: No such File or directory when I open the Terminal - terminal

Every time I open the terminal I keep getting this:
bash: /usr/local/Cellar/nvm/0.33.0/nvm.sh: No such file or directory
I have tried reloading. No idea why all of a sudden this has come up. Any guesses guys?

You need to update your nvm via homebrew:
brew upgrade nvm

I was getting the same error after I installed another NVM version manually (forgetting that I have had installed an older version via homebrew).
That resulted in a wrong path within configuration in your .bash_profile, .bashrc or any other similar file which gets started each time you run a new terminal window.
According to https://github.com/creationix/nvm#installation, look for something like
export NVM_DIR=~/.nvm
[ -s $NVM_DIR/nvm.sh ] && . $NVM_DIR/nvm.sh
This configuration is normally set while installing of NVM. I have had a wrong path in it, die above will work when your NVM resides in ~/.nvm
Hope that helps you.

Related

Local development on Mac M1 | Laravel & VueJs

I've just switched to MacOs - never used it before and I'm using Macbook M1 Pro, so a newbie here. Also, I've only started with web dev so I'm fairly new in this field as well.
Now, how should I proceed in order to set-up a local development enviroment - I plan to use mainly Laravel & VueJs?
Things I've done so far:
Installed VS code
Installe MAMP
Cloned my Git repository with project I was working on (Windows 10)
This is the part where I need help - I think I'm supposed to install Homebrew, but even if I follow the instructions on their website I can't get it working properly. It's installed but as soon as I close & reopen the terminal, it throws zsh: command not found: brew. The commands I'm used to - php artisan xyz or npm run watch don't work
Do you guys have some guide or step-by-step tutorial of what should I do in order to get my Laravel&Vue git project up & running on a localhost?
brew is installed in /usr/local/Homebrew/bin/brew (symlinked to /usr/local/bin/brew). Make sure /usr/local/bin is in your PATH, so that brew and newly installed Homebrew packages are available on the command line. This is typically setup by the ~/.zshrc file.
Troubleshooting steps:
Edit $HOME/.zshrc.
If export PATH is not found, add the following line. The important part is to ensure /usr/local/bin is present (and that :$PATH is last) to give it higher precedence. If the export PATH line exists, but commented, uncomment it.
export PATH=$HOME/bin:/usr/local/bin:$PATH
Restart your shell. .zshrc is loaded automatically at shell startup.
Check for brew with the which command:
$ which brew
/usr/local/bin/brew
Update
This suggestion here fixed my issues: https://stackoverflow.com/a/66521797/9682588
So, what I did was:
echo "export PATH=/opt/homebrew/bin:$PATH" >> ~/.bash_profile && source ~/.bash_profile

ZSH: Command not found - after update macOS to 10.15.1

Yesterday I was using all my installed packages without any problem such as mysql, composer, php, brew and co...
However, today I started my MacBook and typed mysql and I got: zsh: command not found: mysql. Not even brew is working anymore and I don't know why.. this is my .zshrc config file and I don't know why it isn't working.
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:/usr/local/bin:~/.composer/vendor/bin:$PATH
Any ideas how to fix this?
Yuck, how did that happen? Try this:
PATH=/bin:/usr/bin:/usr/local/bin:$PATH
export PATH
Whether this works is going to depend on where you have been installing user executables. If you're using homebrew, I would expect it to be /usr/local/bin but perhaps it is something different in your case? You might want to try putting /usr/local/bin first so things installed by homebrew get picked up before the defaults in /usr/bin and /bin (this is what I do, and I'm still alive to talk about it...)
You could also change your default shell back to Bash:
brew install bash
echo '/usr/local/bin/bash' >> /etc/shells
chsh
You might need to use sudo on line 2.

change bash_profile not working

I am working on Mac El Capitan. I have MAMP Pro installed. I am attempting to install composer. Part of the process is making it accessible globally. I have gone in and done vim ~/.bash_profile and added: export PATH=/Applications/MAMP/bin/php/php7.0.0/bin:$PATH
I am using PHP 7.0.0. However when I save and exit (escape :wq) and then run which PHP it is still pointing to the original folder. I have exited out of the terminal window and come back in. I have also run source ~/.bash_profile. Still the which php version points to /usr/bin/php
Any suggestions for what to try next?
This solution worked for me except I ended up putting composer in an apps folder rather than in my usr/bin.
telliott.io/node/969

zsh command not found, likely path issue

I recently switched to zsh from bash and couldn't install any npm bundles. I found some stack overflows telling me to reset the path in my zsh profile, which I did. Now I can't execute any commands, including bundle install.
Things I've tried:
PATH=/usr/bin:/bin:/usr/sbin:/sbin
export path
from the command line
Modifying ~/.zshrc to add
PATH=/usr/bin:/bin:/usr/sbin:/sbin
export PATH
, then saving and restarting iTerm.
When I echo $PATH, this is what I get: /usr/bin:/bin:/usr/sbin:/sbin
Restarting my terminal after each change, I still get: zsh: command not found: bundle
Help would be greatly appreciated!
UPDATE: I tried switching to another computer and cloning the repo down and am getting the same error when I try to bundle install. If I switch to another repo on the other computer (where I didn't mess with the path), bundle install works. On my initial computer (with the path edits), none of the repos allow bundle install.
Do you know where is your bundle program (you can use locate or find) ? It can be in another directory that is not in your path. For example, it can be in /usr/local/bin so you should add this path to your $PATH.

How to put psql on the path when using Postgres.app on OS X?

I've installed Postgres93 on my Mac. I can open the application, and "Open psql" through the app which opens up a command line interface with psql.
However, when I type $ which psql nothing is returned. The installation path is /Applications/Postgres93.app. How do I make $ which psql show the correct result?
Mac OS X - Mavericks
PostgreSQL package, I'm not as sure about. I went here and downloaded it - http://postgresapp.com/
I just had postgres installed and was not able to run the psql command until I ran the following command in my terminal:
export PATH="/Applications/Postgres.app/Contents/Versions/9.5/bin:$PATH"
Now the terminal knows where to find postgres when I use the psql command.
Remember to replace the version number '9.5' with your current version.
I had the same problem with nothing showing for the which psql command till I run the command below to resolve it. The command provided below is just a little tweak of what has already been provided by others here. The only difference is, instead of providing a specific postgres version number in the command, you can simply tell postgres to use the latest postgres version by simply running the following command:
export
PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH"
And now my terminal was able to find the path to postgres when I run which psql.
Hope this helps.
On macOS Mojave these instructions work well:
If your Postgres has not been installed yet, I suggest you use the great "brew" package manager from here https://brew.sh/ :
$ brew cask install postgres
or you can install it usual way from the website
Put this to the bottom of your ~/.bash_profile file:
export PATH="/Applications/Postgres.app/Contents/Versions/latest/bin:${PATH}"
Restart your terminal or restart your ~/.bash_profile directly with the command:
$ . ~/.bash_profile
Verify your installation:
$ psql --version
** Edited: to include a permanent fix, not just during your current session. **
I had this same problem, and also found a clear answer lacking in the docs.
To fix:
Download the new app, and follow the instructions to move it to the Applications folder
Add the new bundle to your path by typing the following in your Terminal (version number specific - mine is 9.4):
PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
To fix the issue on a permanent basis, run the same line but with export in front:
export PATH="/Applications/Postgres.app/Contents/Versions/9.4/bin:$PATH"
It appears that you installed Heroku's Postgres.app, which is a tool intended for throw-away testing and development. Add the contents of the bundle to your PATH by following the instructions in the Postgres.app documentation - see "command line tools".
On macos mojave i've added the following line on my ~/.profile :
export PATH=$PATH:/Library/PostgreSQL/10/bin
the psql command line client lies into this folder. i've used the enterprisedb installer.
I just experienced the same problem, and solved it by adding export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.4/bin to .bash_profile. Note that this line is version-specific, so be sure to check this line against your current version of Postgres.app.
Using Mac OS Monterey, the latest Homebrew (3.4.0) and postgres#13.
I was able to add psql to the path by using -
export PATH="/opt/homebrew/Cellar/postgresql#13/13.6/bin:$PATH"
Replace #13 and 13.6 with your version.
The latest homebrew install location seems to be /opt/homebrew/*
I'm using catalina 10.15.3 and I had the same issue after installing psql using homebrew. Then I noticed, homebrew mentioned
==> libpq
libpq is keg-only, which means it was not symlinked into /usr/local,
because conflicts with postgres formula.
If you need to have libpq first in your PATH run:
echo 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile
So, I ran 'export PATH="/usr/local/opt/libpq/bin:$PATH"' >> ~/.bash_profile and psql was added to my path
In Mac, there is a SQL Shell application already under /Applications/PostgresSQL
try that
Also, you can run /Library/PostgreSQL/11/scripts/runpsql.sh
In my case, I installed Postgres12 and had the same issue. I had to look out for the location of my bin folder. It happened to be in /Applications/2ndQuadrant/PostgreSQL/12/bin. So I had to run export PATH="/Applications/2ndQuadrant/PostgreSQL/12/bin:$PATH" in my terminal and restart the terminal. That solved it.

Resources