I'm trying to write my first bash script to essentially install a bunch of dependencies and then execute a script.
I'm struggling debugging this with the user b/c I'm a dev which means I already have a bunch of tools installed (such as homebrew, ruby, node, etc) and my user has a fresh install of OSX. I want this script to work with all new users with fresh installs of OSX.
I am trying to export a bare bones
PATH at the beginning of my script simply for debugging purposes to mimic the users fresh install.
My issue at hand is that I'm not sure how to actually reference
npm specifically so that I can run
You can see what my
echo's are producing. Any ideas how to properly install node/npm and then execute it?
#!/bin/bash # Install necessary deps and runs script to create user for the DEV environment. # Mainly used for non engineers to be able to create their own emails. export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin::/usr/local echo $PATH # Install homebrew /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" # Install node 8 /usr/local/bin/brew install node@8 # Install npm - https://stackoverflow.com/a/36631430/222403 /usr/local/bin/brew postinstall node@8 echo /usr/local/bin/brew --prefix node@8 = $(/usr/local/bin/brew --prefix node@8) echo which node = $(which node) --> PRINTS which node = echo which node@8 = $(which node@8) --> PRINTS which node@8 = echo which npm = $(which npm) --> prints which npm = ....