Misc tips
Adding pip installed binaries to our $PATH
Doing a pip3 install mkdocs
will not add mkdocs
to our $PATH
, atleast in Mac.
So one would not be able to run mkdocs
from the terminal.
To fix this, find where pip installs these with
python3 -m site --user-base
and then in your ~/.zprofile
or ~/.profile
, add that in
export PATH="$HOME/Library/Python/3.9/bin:$PATH"
In my case, it was at $HOME/Library/Python/3.9
. The binaries are in a bin
folder
inside it.
Postgres cli tools on Mac
Have homebrew installed and then install libpq
$ brew install libpq
Then in your ~/.zprofile
add
#path for psql and pg_restore and other binaries
export PATH="/usr/local/opt/libpq/bin:$PATH"
#For compilers to find libpq you may need to set:
export LDFLAGS="-L/usr/local/opt/libpq/lib"
export CPPFLAGS="-I/usr/local/opt/libpq/include"
#For pkg-config to find libpq you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/libpq/lib/pkgconfig"
Now in a terminal, you can run psql
Call your scripts globally
In your ~/.zprofile
add
[ -d $HOME/bin ] && export PATH="${HOME}/bin:${PATH}"
then make a folder called bin
in your $HOME
folder. Put all your scripts in that
folder to be globally invoked from your terminal.
Common errors
1. Internal watch failed: ENOSPC: System limit for number of file watchers reached ...
This happens when we have a couple of projects being run in dev mode i.e in nodemon
.
nodemon
works by looking at file changes in your project. By default linux has limits
on the maximum number of files it'd allow to be open at any time.
To resolve this, run the following in a terminal to increase the number of files that can be opened at a time
echo fs.inotify.max_user_watches= 131070 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
We might need to reboot.