Build a version control environment for Python, Ruby, Perl, Node.js on UNIX

The one I wrote for new students in the laboratory. Build an environment for version control of various scripting languages. Version control with pythonbrew, rvm, perlbrew, nvm, and package management with pip, gem, cpanm, npm.

For apps, read [Summary] Over 100 general-purpose tools that programmers who don't know will lose and put them in as appropriate.

Mac users go through the steps up to "installing homebrew". After that, you only have to do what you need. For other UNIX-like people, use yum or apt to prepare the necessary packages, and then do what you need after "Installing homebrew".

Increase OS X version

[]->[Software Update...]

Wait until the installation is complete

Xcode installation

Download

Download and install the latest version of Xcode for Lion from here

(Optional) Install Xcode Command Line Tools

Start Xcode and select Command Line Tools from [Xcode]-> [Preferences]-> [Downloads] to install. Without this, homebrew can (very rarely) be weird.

Java Runtime installation

Similarly, download and install the Java for OS X Developer Package

homebrew installation (+ git)

Installation - homebrew

Do the following in the terminal

$ ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
$ brew install git
$ brew update

Requires git for version control of homebrew itself

(Optional) zsh installation

If you are not particular about the shell

$ brew install zsh

(Optional) install oh-my-zsh

If you haven't prepared .zshrc yourself before, you can add it.

$ curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

python environment construction

pythonbrew

$ curl -kL http://xrl.us/pythonbrewinstall | bash
$ echo '[[ -s "${HOME}/.pythonbrew/etc/bashrc" ]] && source $HOME/.pythonbrew/etc/bashrc' >> ~/.zshrc
$ pybrew install -fn 2.7.2 3.2  #Takes time

(Optional) Separate virtualenv

If you want to create a virtualenv and isolate the package

$ pybrew venv create lab -p 2.7.2
$ pybrew venv create lab -p 3.2

This will create a virtualenv named lab in python2.7.2 and 3.2 respectively. If you are not sure, I recommend you to make it for the time being, as it is likely that you will not regret it later.

How to switch python versions

$ pybrew switch 2.7.2
$ pybrew switch 3.2

The person who created virtualenv

$ pybrew venv use lab -p 2.7.2
$ pybrew venv use lab -p 3.2

Modules that you want to use across venv should be installed after turning off venv (see ipython installation)

How to install the module

Switch to the version you want to install with pybrew and then run

$ pip install PACKAGE_NAME

(Optional) ipython installation

$ pybrew switch 2.7.2  #2 without venv.7.Move to 2
$ pip install ipython
$ pybrew venv use lab

launch ipython

$ ipython

Modules installed without venv can be referenced from all venv.

ruby environment construction

rvm

$ curl -L get.rvm.io | bash -s stable
$ echo '[[ -s "${HOME}/.rvm/scripts/rvm" ]] && source $HOME/.rvm/scripts/rvm' >> ~/.zshrc
$ rvm install 1.9.3  #Takes time

(Optional) gemset

Isolate the environment using gemset. If you don't understand this, you should finally do it.

$ rvm use 1.9.3
$ rvm gemset create lab
$ rvm use 1.9.3@lab --default

There is a gemset named global, and the gems in it can be referenced by all other gemsets, so it's a good idea to put generic tools in global. (Refer to the item of pry installation)

(Optional) Avoid installing documentation with gems

Only for those who don't need documentation

$ echo 'gem: --no-ri --no-rdoc' >> ~/.gemrc

gem installation

$ gem install PACKAGE_NAME

(Optional) Install pry

Interactive shell for ruby. It is necessary without depending on gemset, so put it in global

$ rvm use 1.9.3@global
$ gem install pry
$ rvm use 1.9.3@lab  #return

To start

$ pry

perl environment construction

perlbrew

By default perlbrew is installed in $ HOME / perl5 / perlbrew. If you don't like this

$ echo 'export PERLBREW_ROOT=$HOME/.perl5/perlbrew' >> .zshrc
$ source ~/.zshrc
$ curl -kL http://install.perlbrew.pl | bash
$ echo '[[ -s "${HOME}/.perl5/perlbrew/etc/bashrc" ]] && source $HOME/.perl5/perlbrew/etc/bashrc' >> ~/.zshrc
$ perlbrew install perl-5.14.2  #Takes time
$ perlbrew switch perl-5.14.2
$ perlbrew install-cpanm

node environment construction

nvm

$ git clone git://github.com/creationix/nvm.git ~/.nvm
$ echo '[[ -s "${HOME}/.nvm/nvm.sh" ]] && source $HOME/.nvm/nvm.sh' >> .zshrc
$ nvm install v0.6.15  #Takes time
$ nvm alias default v0.6.15

Package installation

When you insert node with nvm, npm can be used automatically. By default, npm manages packages on a project-by-project basis, so you don't have to manage packages separately with gemset in rvm.

To install the package:

$ npm install PACKAGE_NAME

Doing this will create a directory called node_modules in the current directory. This node_moduels is referenced from all node projects under the current directory.

If you want to place it in a global location, add the -g option. CoffeeScript installation reference

(Optional) Install CoffeeScript

$ npm install -g coffee-script

Recommended Posts

Build a version control environment for Python, Ruby, Perl, Node.js on UNIX
Build a python3 environment on CentOS7
Build a python environment on CentOS 7.7 for your home server
Build a python environment on MacOS (Catallina)
Build a Python + OpenCV environment on Cloud9
Simply build a Python 3 execution environment on Windows
Build a python environment with ansible on centos6
Build a Python environment on Mac (Mountain Lion)
Build a Python development environment on your Mac
Build a Kubernetes environment for development on Ubuntu
Build a Python development environment on Raspberry Pi
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
Build a local development environment for Laravel6.X on Mac
Build a machine learning Python environment on Mac OS
Build a Python extension for E-Cell 4 on Windows 7 (64bit)
Build a python environment for each directory with pyenv-virtualenv
Build a GVim-based Python development environment on Windows 10 (1) Installation
How to build a Django (python) environment on docker
Build a Python development environment on Mac OS X
Build a Python environment on your Mac using pyenv
Procedure for building a CDK environment on Windows (Python)
Build a Python development environment using pyenv on MacOS
How to build a Python environment on amazon linux 2
Build Python environment on Windows
Build python environment on windows
Build a Python environment offline
Build an environment for machine learning using Python on MacOSX
How to build a new python virtual environment on Ubuntu
Build a python data analysis environment on Mac (El Capitan)
Build a GVim-based Python development environment on Windows 10 (2) Basic settings
Build a Python extension for E-Cell 4 on Mac OSX (Yosemite)
Create a virtual environment for python on mac [Very easy]
Building a Python environment on Mac
Virtual Environment Version Control Summary Python
Building a Python environment on Ubuntu
Create a Python environment on Mac (2017/4)
Create a python environment on centos
Build Python 3.8 + Pipenv environment on Ubuntu 18.04
Create a Python environment for professionals in VS Code on Windows
Build and test a CI environment for multiple versions of Python
Build a 64-bit Python 2.7 environment with TDM-GCC and MinGW-w64 on Windows 7
Build a Python environment on your Mac with Anaconda and PyCharm
# 3 Build a Python (Django) environment on AWS EC2 instance (ubuntu18.04) part2
Try using virtualenv, which can build a virtual environment for Python
How to build a Python environment using Virtualenv on Ubuntu 18.04 LTS
Build an environment for Blender built-in Python
Python 2.7, 3.4, 3.5 extension module build environment on Windows
Build Python3 and OpenCV environment on Ubuntu 18.04
Create a python environment on your Mac
Let's create a virtual environment for Python
[Mac] Building a virtual environment for Python
Creating a python virtual environment on Windows
Build Python environment with Anaconda on Mac
Build a python virtual environment with pyenv
Build a modern Python environment with Neovim
Building a Python development environment for AI development
Things to watch out for when creating a Python environment on a Mac
Build a Python + bottle + MySQL environment with Docker on RaspberryPi3! [Easy construction]
Quickly build a python environment for deep learning and data science (Windows)
Build a "Deep learning from scratch" learning environment on Cloud9 (jupyter miniconda python3)