Open a page on mobile when on localhost (Mac)

Get the IP address to check a localhost webpage on the phone when the server is running on the Mac. Don't forget to add the port. (e.g. Note that this works only when both the Mac and your phone are on the same network.

ifconfig | grep inet | grep 192 | awk '{print $2}'

Side note: navigator.clipboard.writeText() won't work on iOS Safari for security reasons (TODO: ref)

<a href="" target="_blank" rel="noopener noreferrer">link name</a>
  • TODO: explain in short the security issues when using only the target="_blank" attribute-value pair


Start a service installed via brew.

Optionally use --verbose to debug any issues

brew services start --verbose postgresql@14

Stop a service installed via brew.

brew services stop --verbose postgresql@14

See which services are running via brew

brew services list

List packages installed via brew

brew list

Misc brew commands

brew uninstall --ignore-dependencies node 
brew uninstall --force node 
brew update
brew install nvm 


Node Version Manager is super useful for switching between node.js versions.

nvm ls
nvm use stable
nvm use v14.19.2
nvm alias default 16.13.2


Install a specific npm version

When using node.js version, a version of npm that ships with that node version will be used by default. To override, you can specifically install the version of npm you like (of course, you should be aware of the compatibility between those node and npm versions). To achieve this, install a specific npm version like so:

npm install -g npm@8.10.0

Note: When using nvm, if you switch node versions, the paired version of npm will be used. Explanation: node v14.19.2 ships with npm v6.14.17 and node v16.13.2 came with npm v8.1.2 ; now, if you install a different npm version by using the command above, say for node v14.19.2 you installed npm v8.10.0 ; And now you decided to switch to node v16.13.2 ; When you switch to node v16.13.2 and check npm -v you'll see 8.1.2. So each npm package install instance (?) is tied to a specific node version when using nvm.

More npm commands

  • Todo explain, or at least add a title each.
npm i --legacy-peer-deps
npm i -g sails
npm link local-package