Upgrading Julia for GMT.jl users

What is the best way to upgrade Julia when you have the GMT.jl package installed?

I’m on Mac OS (Intel Processor). It happened a few times that after upgrading to a newer version of Julia, I can no longer use my GMT.jl. I ended up reinstalling my entire Mac OS system in order to fix the issue.

I wonder if there is a better way of upgrading Julia to the latest version without messing up with my GMT.jl package. Thanks.

Well there are several important layers here.

You may want to use juliaup to manage your Julia versions:

The second item is project environment hygiene. Rather than adding all your packages to your shared @1.7 environment, create specific environments for each project. Put the Project.toml and Manifest.toml into version control.

GMT appears to require external binaries outside of the BinaryBuilder world, so this likely adds some complications. In some cases the package appears to use conda-forge. By default Julia creates it’s own conda-forge environment within the Julia depot (by default this is in ~/.julia). One step you might want to consider is using a specific depot for GMT. This can be altered via the JULIA_PROJECT environmental variable.

It really should not be necessary to reinstall the entire operating system. Before doing that, I would try moving the ~/.julia folder to a new location, and then starting with a clean depot.

The latest stable Julia version is 1.7.3. Versus other 1.7.x releases, this should only contain fixes. For your case I would not recommend trying 1.8 or 1.9 before they are released.

4 Likes

@mkitti is totally right and I second that: there is absolutely no need to reinstall an operating system if something like Julia or Python stops working. Especially Julia is really living inside a single folder and does not mess with your system’s filesystem: everything is in ~/.julia.

If you want to be extra cautious with upgrading Julia, do something like mv ~/.julia ~/.julia_backup and if anything goes wrong with the latest version of Julia, just delete ~/.julia and move the backup back and simply start the old Julia version.

2 Likes

Many thanks all for the replies. This is very helpful.

Sorry but I can’t make a sense out of this and it’s the first time I hear it. What was the error after the Julia upgrade? Do you have a previously installed GMT or the one that is automatically installed by conda when a system one is not found?

Unfortunately, I don’t remember the error messages or the details about how I installed my GMT.jl.

Below is how I installed my latest GMT.jl on my current system:

  1. Install homebrew:
    /bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)”

  2. Install Ghostscript:
    brew install ghostscript

  3. Install GMT.jl
    Open Julia
    ] add GMT

If you didn’t install GMT after 1. doing step 3. alone would have been enough.