-
-
Save jordandraper/581650d8dbdf24859c393ea7da37948d to your computer and use it in GitHub Desktop.
brew install --cask iterm2
Or, if you do not have homebrew (you should ;)): Download and install iTerm2
More info here: https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH
More info here: https://github.com/robbyrussell/oh-my-zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
When the installation is done, edit ~/.zshrc
and set ZSH_THEME="agnoster"
for the default look. Or better yet, go for Powerlevel10k.
Why Powerlevel10k? Well, because it's a drop-in replacement for Powerlevel9k, just a lot faster to render your prompt. ls
feels fast again!
It's best to just follow the instructions at the source
- Install the recommended font. Just do it.
If you want to trigger the configuration wizard immediately, simply run p10k configure
to discover all options, which are plentiful.
If you did not go with Powerlevel10k (you should) or you want another font, read on:
- Source Code Pro
- Source Code Pro + Font Awesome, this one is needed if you want the icons from Font Awesome as shown in the screenshot for Powerlevel10k.
- Others @ powerline fonts
- Nerd Fonts
Open the downloaded font and press "Install Font".
Set this font in iTerm2 (iTerm → Preferences → Profiles → Text → Font), in the dropdown select the desired Font. You will see it change on the fly.
Restart iTerm2 for all changes to take effect.
Things like
- ZSH Plugins
- auto suggestions
- word jumping with arrow keys / natural text editing
- syntax highlighting
- iTerm color customization
- fig integration
- visual studio code config
can be found in the section below.
There are plenty of plugins to checkout Some recommended are:
- git
Just follow these steps: https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md#oh-my-zsh
Or if you want to follow from the souce: https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md
If the auto suggestions do not appear to show, it could be a problem with your color scheme. Under "iTerm → Preferences → Profiles → Colors tab", check the value of Black Bright, that is the color your auto suggestions will have. It will be displayed on top of the Background color. If there is not enough contrast between the two, you won't see the suggestions even if they're actually there..
This plugin for Zsh adds real-time type-ahead autocompletion to your command line, similar to what you find desktop apps.
Just follow these steps: https://github.com/marlonrichert/zsh-autocomplete?tab=readme-ov-file#installation--setup
If you need to clear your ZSH history in general, and as such clear the list of auto suggestions, you can add the following to you ~/.zshrc
file:
# Disable History if the command is preceded by a space (https://unix.stackexchange.com/a/6104)
setopt HIST_IGNORE_SPACE
# Clear history with `clear_history` command
alias clear_history='echo "" > ~/.zsh_history & exec $SHELL -l'
The first entry will prevent any command preceded by a space to be witheld from history. The second entry creates an aliased command clear_history
which will delete you ZSH history.
By default, word jumps (option + → or ←) and word deletions (option + backspace) do not work. To enable these, go to "iTerm → Preferences → Profiles → Keys → Key mappings → Presets... → Natural Text Editing → Boom! Head explodes"
Install instructions straight from the source
Restart iTerm2 for all changes to take effect.
iTerm2 has better color fidelity than the built in Terminal, so your themes will look better.
Get the iTerm color settings of your choice. I've included some recommendations below.
- Personal Favorite: Nord
- iTerm2 Color Schemes
- Solarized Dark theme (patched version to fix the bright black value)
- Solarized Light theme
- Material Design
- More themes @ iterm2colorschemes
Just save it somewhere and open the file(s). The color settings will be imported into iTerm2. Apply them in iTerm through iTerm → preferences → profiles → colors → load presets. You can create a different profile other than Default
if you wish to do so.
You might also want to install Fig which provides alternative shell completions for many command line tools with an IDE-like popup interface in the terminal window.
Installing a patched font will mess up the integrated terminal in VS Code unless you use the proper settings. You'll need to go to settings (CMD + ,) and add or edit "terminal.integrated.fontFamily""
If you're following along, you will have installed the suggested Powerlevel10k fonts, and so you'll need to edit it to
"terminal.integrated.fontFamily": "MesloLGS NF, Regular"
If you installed a different font:
- for Source Code Pro + Font Awesome:
"terminal.integrated.fontFamily": "'SourceCodePro+Powerline+Awesome Regular'"
. The single quotes are important! Restart VS Code after the config change. - for Source Code Pro:
"terminal.integrated.fontFamily": "Source Code Pro for Powerline"
- for other fonts you'll need to check the font name in Font Book. You can right click on them on select "Show in Finder" to get the exact name.
You can also set the fontsize e.g.: "terminal.integrated.fontSize": 14
You may also like to change your VS Code Theme:
Python can be slightly complicated to install due to PATH. It may be helpful to first understand how PATH works
-
On macOS, you can install the latest version of Python using Homebrew with the command
brew install python
. After installation, the Python interpreter is typically accessible viapython3
. Depending on your system thepython
command might still point to Python 2.x, and it's advisable to use python3 for Python 3.x.- If
python3
does not work, troubleshoot with:- Run
which python3
to find the location of your Python installation. - Add an alias such as
alias python="/path/to/python3"
to~/.zshrc
using the installation location found above. Replace/path/to/python3
with the actual path. - Alternatively, add this location to your PATH variable from within your shell's configuration file (e.g.,
~/.zshrc
for Zsh or~/.bash_profile
for Bash) by adding the lineexport PATH="/path/to/python3:$PATH"
. Replace/path/to/python3
with the actual path.
- Run
- If
-
If you want to be able to just call
python
andpip
and you know you won't have any conflicts then you can add an alias such asalias python=/opt/homebrew/bin/python3 alias pip=/opt/homebrew/bin/pip3
Homebrew automatically makes python3
an available command after installing Python on macOS. When you install Python using Homebrew, it takes care of setting up the necessary links and paths so that you can immediately start using python3
from the terminal.
Here's a brief overview of what happens:
-
Installation: When you run
brew install python
, Homebrew downloads and installs Python 3. -
Symlinking: Homebrew creates symlinks (symbolic links) in
/usr/local/bin
(or/opt/homebrew/bin
on Apple Silicon Macs) that point to the installed Python binaries. This is why you don't need to manually add Python to your PATH. -
Versioning: Homebrew installs Python 3 with the
python3
command to differentiate it from Python 2, which traditionally uses thepython
command. This helps in environments where both Python 2 and Python 3 are installed. -
Accessibility: After installation, you can use the
python3
command in the terminal to start the Python 3 interpreter. Similarly,pip3
is installed for Python 3 package management.
It's worth noting that if you previously had another version of Python installed (not through Homebrew), the python3
command might refer to that version. Running which python3
will show you the path of the Python 3 version that's being used, and brew info python
will provide information about the Python version installed by Homebrew, including its location.
-
If you need a specific version of Python,
pyenv
is a great tool. It allows for easy installation and switching between different Python versions. For setup and usage instructions, visit pyenv's GitHub repository." -
pyenv
is not complete without pyenv-virtualenv which provides features to manage virtualenvs and conda environments for Python on UNIX-like systems.- A quick overview is here
-
Make sure the version of python you'll be using is installed
For example, to download and install Python 3.6.3, run:
$ pyenv install 3.6.3
-
Create virtualenv based on your required version of python
Provide the name and version of python to use. If the version is left blank, it will use your environment's current version. You can check your current version using
$ pyenv versions
.sh $ pyenv virtualenv 3.6.3 venv36
NOTE: You can list existing virtualenvs with
pyenv virtualenvs
NOTE: You can delete existing virtualenvs with
pyenv uninstall <virtualenv_name>
-
Set your project to always use this virtualenv.
sh $ pyenv local venv36
This will create a local file called
.python-version
. If you've set everything up correctly, this virtualenv should be activated upon entering this directory and deactivated when leaving.
-
Alternatively, once you've activated a certain python version say with
pyenv shell "version number"
, you can use the standardpython -m venv "env folder name"
where "version number" and "env folder name" are changed appropriately.