Skip to content

Language installation

Tsuyoshi Tokuda edited this page Oct 31, 2022 · 10 revisions

Go

Configure goenv and install Go

I use goenv to manage multiple Go versions.
I sometime develop application with Go version of Google App Engine. So I need to switch to the specific Go version.

❯ goenv install -l
Available versions:
  1.2.2
  1.3.0
  ...
  1.19.1
  1.19.2

To install a specific version of Go and set it as a default version:

❯ goenv install 1.16.15
Downloading go1.16.15.darwin-amd64.tar.gz...
-> https://go.dev/dl/go1.16.15.darwin-amd64.tar.gz
Installing Go Darwin 64bit 1.16.15...
Installed Go Darwin 64bit 1.16.15 to /Users/tokuda109/.goenv/versions/1.16.15

❯ goenv global 1.16.15

To list all Go versions known to goenv:

❯ goenv versions
* 1.16.15 (set by /Users/tokuda109/.goenv/version)

Install the gopls package

❯ go install golang.org/x/tools/gopls@latest

❯ gopls version
golang.org/x/tools/gopls v0.9.5
    golang.org/x/tools/[email protected] h1:F3TO5th6TUg40FHrpxZfMkMlVaaTmByeEvylgVHGH2A=

Node.js

Configure nodenv and install Node.js

I use nodenv to manage multiple Node.js versions.

Since nodenv and node-build are configured in the Brewfile, you can get a list of available versions of Node.js with the following command:

❯ nodenv install -l

The list of Node.js versions is maintained in node-build, so updating node-build will allow you to install new versions.

❯ nodenv install 18.11.0

To list all Node.js versions known to nodenv:

❯ nodenv versions
  system
* 18.11.0 (set by /Users/tokuda109/.nodenv/version)

.node-version file

To specify the target node version for each project, I put the .node-version file in repositories.
By placing the .node-version file in the root of the repository, nodenv will automatically switch the Node.js version used in the project.

And I use Starship for the prompt, and it also references the .node-version file to show the Node.js version in use at the prompt. (Node.js - Configuration - Starship)

Python

I use pyenv to manage multiple Python versions.

❯ pyenv install --list
Available versions:
  2.1.3
  2.2.3
  ...
  stackless-3.5.4
  stackless-3.7.5

To list all Python versions known to pyenv:

❯ pyenv versions
  system
* 3.10.6 (set by /Users/tokuda109/.pyenv/version)

To check the current Python version:

❯ python -V
Python 3.10.6

Terraform

❯ tfenv list-remote
1.3.3
1.3.2
...
0.1.1
0.1.0

To install a specific version of Terraform:

❯ tfenv install 1.3.3
Installing Terraform v1.3.3
...
Installation of terraform v1.3.3 successful. To make this your default version, run 'tfenv use 1.3.3'

To list all Terraform versions known to tfenv:

❯ tfenv list
  1.3.3
* 1.2.7 (set by /usr/local/Cellar/tfenv/3.0.0/version)

To install a specific version of Terraform and set it as a default version:

❯ tfenv use 1.3.3
Switching default version to v1.3.3
Default version (when not overridden by .terraform-version or TFENV_TERRAFORM_VERSION) is now: 1.3.3