Backstory: I've been given a lender computer from the school I'm attending and I was attempting to npm install global packages for my react-native project. I was able to install the packages, but my programs didn't appear to know how to actually access those globally installed packages. That's my theory at least. So I started going down the google rabbit hole ...

The first error I was getting was: expo command not found (expo being Expo CLI, the react-native related package I had install globally numerous times by now), so I went to the provided site and entered the suggested command: echo $PATH in terminal.

After running Echo $Path the above author said:

check if `/users/me/.npm-global/bin` is in your path.

The response from my machine was: /usr/bin:/bin:/usr/sbin:/sbin:

The author than proceeded to say:

If it isn’t there, you will need to add it to the path. 
Open up ~/.bash_profile then add the following line to the bottom:

Well, it appeared that I didn't have a ~/.bash_profile, I assume it said no such directory found or something to akin to that. I can't simulate this error anymore because well ... my terminal at this time immediately crashes on startup.

So, I visited this stackExchange question which asked "How to create ~/.bash_profile and ~/.profile". I followed the steps from the top solution which by all accounts, seemed to successfully create the file.

With the file now seemingly made, I returned back to the original linked site and entered ~/.bash_profile which opened the file and "add[ed] the following line to the bottom:"

# NPM global installs
export PATH=$PATH:~/.npm-global/bin

Follow that I returned to the shell and entered: source ~/.bash_profile. I don't have access (currently) to the error I was getting when I entered that command in the shell, but I believe the error was something related to the directory wasnt found.

Anyway, I changed something ... I think(?) I added the line source ~/.bash_profile to the nano terminal window where I earlier entered the above command ... but at this point I can even get back there to confirm that was the case.

So that's where I am now, I still can't access the globally installed files or at this point even open my terminal without it instantly closing.

On last thing, i entered usr/bin:/bin:/usr/sbin:/sbin in the iterm2 > preferences > profiles > general > command destination. That's exactly where I am now and why my iterm broken pipe error says what it says.

  • I think you didn't check the file with hidden files and folders visible and created something(?) new. If you want to see bash profile, open Finder, type command + shift + . to reveal hidden files and then command + shift + G and type ~/.bash_profile in "Go To". Remove the file that was created later and try to fix the original file(if modified today). Try searching here stackexchange.com/search?q=bash_profile. Also, highlight the question you're trying to get solved by editing your question. It's a bit hard to find it.
    – anki
    Commented Aug 30, 2019 at 2:58

1 Answer 1


Question asker here ...

I had the fortunate luck of working through this in a screen share with a graduate from the school and the solution we found regarding my issue is that I had this in my .bash_profile file:

source ~/.bash_profile
export PATH=$PATH:~/.npm-global/bin

So, the immediate issue was the source ~/.bash_profile, this was causing the piping error and crashing all my terminals.

Q: How did we access this file if terminal was broken?

A: I went into vscode (any text editor will probably work just the same) and opened the files path. So, vscode > file > open > X's MacBook Pro > untitled > Users > X > clicked open. This opened all the files (including the hidden one we want access to) and opened the file named .bash-profile.

In the .bash-profile file I updated it from what was posted above to whats posted below and saved it.

export PATH=$PATH:"~/.npm-global/bin"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .