joeerl

joeerl

Creator of Erlang - Fondly Remembered

Upgrading Elixir - how to check versions, delete, and upgrade?

Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questions.

I want to start of with the “latest and greatest” so that my questions when I get stuck are relevant. So

  1. What do I need and how do I get them

I think I need Elixir Erlang and Mix and possibly Hex

I have in the past installed all of these - so my file system is a bit of a historical mess - so

  • how do I find out which versions I already have?
  • how do I find out the latest versions?
  • how do do I update to the latest versions?
  • how do I delete old versions if they are not needed?

I realize I can find the answers to all these questions by Googling and experimentation but it would be very nice to find the answers “all in one place”

The “brew doctor” command is pretty good at flushing out old systems and telling me what to do - so it would be very nice if there was an equivalent command - let me daydream a bit:

> elixir doctor
Wow Joe you already have elixir installed
but it's a really old version ...
you might like to delete the old version with 'elixir 
remote_old_versions'
and then do 'elixir upgrade'
....

Cheers

/Joe

Most Liked

cpgo

cpgo

Im a big fan of https://github.com/asdf-vm/asdf.
You can manage a multitude of language versions, including elixir and erlang and set up global or per project versions.

12
Post #2
ryanwinchester

ryanwinchester

I know this is old but I’m here to not preach language version managers or anything and just offer the simplest most straightforward upgrade since you mentioned you are using homebrew?

Upgrading Elixir if it was installed with homebrew is pretty easy. Erlang is a dependency that will be installed or updated for you by homebrew as needed.

  1. brew update
  2. brew upgrade elixir
  3. elixir --version

(I never do brew upgrade without a specfic formula, as that has caused me many headaches in the past)

Happy Elixiring!

10
Post #9
peerreynders

peerreynders

As you seem to be using homebrew you can use $ brew list FORMULA:

$ brew list elixir
/usr/local/Cellar/elixir/1.7.2/bin/elixir
/usr/local/Cellar/elixir/1.7.2/bin/elixirc
/usr/local/Cellar/elixir/1.7.2/bin/iex
/usr/local/Cellar/elixir/1.7.2/bin/mix
/usr/local/Cellar/elixir/1.7.2/lib/eex/ (7 files)
/usr/local/Cellar/elixir/1.7.2/lib/elixir/ (231 files)
/usr/local/Cellar/elixir/1.7.2/lib/ex_unit/ (29 files)
/usr/local/Cellar/elixir/1.7.2/lib/iex/ (30 files)
/usr/local/Cellar/elixir/1.7.2/lib/logger/ (12 files)
/usr/local/Cellar/elixir/1.7.2/lib/mix/ (90 files)
/usr/local/Cellar/elixir/1.7.2/share/man/ (4 files)
$ brew list erlang
/usr/local/Cellar/erlang/21.0.5/bin/ct_run
/usr/local/Cellar/erlang/21.0.5/bin/dialyzer
/usr/local/Cellar/erlang/21.0.5/bin/epmd
/usr/local/Cellar/erlang/21.0.5/bin/erl
/usr/local/Cellar/erlang/21.0.5/bin/erlc
/usr/local/Cellar/erlang/21.0.5/bin/escript
/usr/local/Cellar/erlang/21.0.5/bin/run_erl
/usr/local/Cellar/erlang/21.0.5/bin/to_erl
/usr/local/Cellar/erlang/21.0.5/bin/typer
/usr/local/Cellar/erlang/21.0.5/lib/erlang/ (4393 files)
/usr/local/Cellar/erlang/21.0.5/share/doc/ (1261 files)
$

to upgrade simply follow the usual homebrew process:

$ brew update

and then

$ brew upgrade
$ elixir -v
Erlang/OTP 21 [erts-10.0.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.7.2 (compiled with Erlang/OTP 21)
$

For that command to work Erlang and Elixir have to be on the PATH. So in your ~/.bash_profile there should be something like:

export PATH=/usr/local/opt/openssl/bin:/usr/local/opt/erlang/bin:/usr/local/opt/elixir/bin:$PATH;

Cleanup:

$ brew list --versions erlang
erlang 21.0 20.3.6 21.0.5 21.0.4 20.3.4
$ brew list --versions elixir
elixir 1.7.1 1.6.5 1.6.4 1.7.2 1.6.6
$ brew cleanup elixir
Removing: /usr/local/Cellar/elixir/1.6.4... (411 files, 5.4MB)
Removing: /usr/local/Cellar/elixir/1.6.5... (411 files, 5.4MB)
Removing: /usr/local/Cellar/elixir/1.6.6... (412 files, 5.4MB)
Removing: /usr/local/Cellar/elixir/1.7.1... (413 files, 5.5MB)
==> This operation has freed approximately 21.7MB of disk space.
$ brew cleanup erlang
Removing: /usr/local/Cellar/erlang/20.3.4... (7,036 files, 277.4MB)
Removing: /usr/local/Cellar/erlang/20.3.6... (7,036 files, 277.3MB)
Removing: /usr/local/Cellar/erlang/21.0... (5,668 files, 271.8MB)
Removing: /usr/local/Cellar/erlang/21.0.4... (5,668 files, 271.7MB)
==> This operation has freed approximately 1GB of disk space.
$ 
amnu3387

amnu3387

One more for asdf https://github.com/asdf-vm/asdf

If you want to remove all versions installed with brew and prevent it from installing again whenever you update brew, caution that this is non-reversible, brew uninstall <name> --force

For asdf, after installing and enabling it (first section on the GitHub page), you can do:


asdf plugin-add erlang

asdf plugin-add elixir

asdf install elixir 1.7.2

asdf install erlang 21.0.5

After you can do:

asdf list erlang

Or whatever plugin, to list the installed versions

asdf list-all erlang

To show all available versions (if new versions have been released between the time you installed the plugin, you need to update the plugin to show the new ones, with asdf plugin-update all or asdf plugin-update erlang)

asdf current

To show the current versions of all plugins, or asdf current erlang to just show the current set erlang version. If done from a directory that has a local version specified it will show the local version that is set, anywhere else it will show the global one

asdf uninstall <name> <version> to uninstall a specific one

To set the global versions to use

asdf global <name> <version>

And when you want to pin down a version to use on a project, from the directory of the project,

asdf local <name> <version>

To install hex, after having elixir installed

mix local.hex

And if you want to use phoenix tasks to generate phoenix projects/applications, mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

crispinb

crispinb

No - choco can install win32 elixir for you, and although it’s not intended I think it’s possible to finagle it to install multiple versions. I don’t know the details though.

asdf is very unixy (I think it’s mostly shell scripts), so is never going to run natively in windows. But it works great in wsl.

[Edit - I think wsl is the best place for elixir in windows, unless you have very windows-specific requirements, like building a windows GUI app or building exe’s to run on windows servers]

Where Next?

Popular in Questions Top

Fl4m3Ph03n1x
Background Let’s assume I have a typical GenServer that receives messages as requests, does some operation in a DB and returns responses....
New
dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

We're in Beta

About us Mission Statement