Skip to content

Instantly share code, notes, and snippets.

@gwarf
Last active October 10, 2022 07:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gwarf/9d1043fa40684a87e72014beadbcceb4 to your computer and use it in GitHub Desktop.
Save gwarf/9d1043fa40684a87e72014beadbcceb4 to your computer and use it in GitHub Desktop.
MacOSX_setup

Setup Mac OS X

Homebrew

Install additional tools usikng homebrew.

Install Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew tap caskroom/cask

Updating brew software

brew update
brew upgrade
brew cask upgrade

Minimmal software list

brew install tree zsh neovim

Install Vagrant with Virtualbox using Homebrew

brew cask install virtualbox
brew cask install virtualbox-extension-pack
open /Applications
# Right click on VirtualBox.app
# browse MacOS directory
# copy VBoxGuestAdditions.iso to ~/Documents
# Now it can be loaded in the virtual drive of a guest
# If instlall fails, Open Security & Privacy and allow Oracle to load
# https://developer.apple.com/library/archive/technotes/tn2459/_index.html
# Then restart virtualbox installation 
brew cask install vagrant
brew cask install vagrant-manager

Using Vagrant: https://coolestguidesontheplanet.com/vagrant-getting-started-on-macos/

Using Python with virtualenv: pyenv

  • pyenv is used to manage multiple python installations.

Setting pyenv up

# Setup pyenv
# https://github.com/pyenv/pyenv/wiki
brew install pyenv
brew install openssl readline sqlite3 xz zlib
# Install Xcode from App Store
# Launch Xcode and agree license
xcode-select --install
# Depending on Mac OS X version and libs usages different CFLAGS and LDFLAGS may habe to be set
# Using libs from Xcode
# export CFLAGS="-I$(xcrun --show-sdk-path)/usr/include"
# Using sqlite, readline, zlib and openssl from Homebrew
export CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix zlib)/include -I$(brew --prefix sqlite)/include"
export LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix sqlite)/lib"
# Speeding up build
export CFLAGS="-O2 $CFLAGS"

Using pyenv

# Looking for installable python versions
# Check https://www.python.org/downloads/ for details on versions
pyenv install -l
# Installing a python version
pyenv install 3.7.2
# Checking installed python versions
pyenv versions
# Checking current python version
pyenv version
# Removing a python version
pyenv uninstall 3.7.2
# Set two global version, python 2 as default and another one as python3
pyenv global 2.7.18 3.10.1
# Set directory-specific local version
pyenv local 3.10.7
# Check python versions
python --version
which python
python3 --version
which python3

Working with virtual environments AKA virtualenv

# Using python 2
# Check available python versions
pyenv install --list
# Intall a python version
pyenv install 2.7.18 3.10.7
# Create virtualenv manually, specifying python version and virtualenv location
virtualenv -p $PYENV_ROOT/versions/2.7.18/bin/python ~/.virtualenvs/testpy2
# Activate environment
source ~/.virtualenvs/testpy2/bin/activate
# Install some python packages using pip
pip install pylint
# Check python location
pyenv which python

# Using python 3
# Check available python versions
pyenv install --list
# Intall a python versio
pyenv intall 3.8.5
# Create virtualenv manually, specifying python version and virtualenv location
# Using `-m venv` for python3 >= 3.3
$PYENV_ROOT/versions/3.8.5/bin/python -m venv ~/.virtualenvs/testpy3
# Activate environment
source ~/.virtualenvs/testpy3/bin/activate
# Install some python packages using pip
pip install flake8
# Check python location
pyenv which python

Configure python2 and python3 for Neovim

See https://gist.github.com/gwarf/42a0a13ff2bf32a0e79d347e43831cae

Pyenv shell configuration

pyenv installed using zplug, see my dotfiles for what I'm currently using.

# ~/.zshrc
export PYENV_ROOT="${ZPLUG_HOME}/repos/pyenv/pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --no-rehash - zsh)"

Configure ruby for Neovim

https://neovim.io/doc/user/provider.html https://rvm.io/rvm/install

# Install GPG keys used to sign RVM packages
gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
# Install rvm
curl -sSL https://get.rvm.io | bash -s stable --ruby
# Check installed versions
rvm
# Check available versions
rvm list known
# Set default version
rvm --default use ruby
# Install a new version
rvm install 2.7.0
# Create a gemset for neovim
rvm ruby-2.7.0 do rvm gemset create neovim
# Install neovim gem
rvm ruby-2.7.0@neovim do gem install neovim
# Optionally install a markdown linter
rvm ruby-2.7.0@neovim do gem install mdl
# ~/.config/nvim/init.vim
let g:ruby_host_prog = 'rvm ruby-2.7.0@neovim do neovim-ruby-host'

Neomutt

Full neomutt configuration in my dotfiles repository

brew install urlview
brew install w3m
brew install neomutt

GnuPG with Neomutt and git

brew update
brew install keybase pinentry-mac
keybase login
curl https://keybase.io/gwarf/pgp_keys.asc | gpg --import
gpg --allow-secret-key-import --import ~/Downloads/adasdas.asc
rm ~/Downloads/adasdas.asc
gpg --list-secret-keys
vim ~/.gnupg/gpg.conf
git config --global commit.gpgsign true
brew install pinentry-mac
echo "pinentry-program /usr/local/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf\n
echo "batch" >> ~/.gnupg/gpg.conf\n
git config --global user.signingkey baptiste@bapt.name
git config --global gpg.program gpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment