Simple script for installing Julia on:

MacOS:

#!/bin/bash

# Get the link to the latest version of Julia for macOS
JULIA_URL=$(curl -s https://julialang.org/downloads/ | grep 'href="/bin/macos' | head -n 1 | cut -d '"' -f 2)
JULIA_FILE=$(basename $JULIA_URL)

# Download the Julia installer
curl -L -o $JULIA_FILE https://julialang-s3.julialang.org/bin/macos/x64/1.7/$JULIA_FILE

# Unpack and install Julia
tar xzf $JULIA_FILE
sudo mv ~/Julia-1.7.app /Applications/

echo "Julia has been installed in the /Applications/Julia-1.7.app directory."

Linux:

#!/bin/bash

# Define the version of Julia to install
JULIA_VERSION="1.7.0"

# Define the download URL for the Julia tarball
JULIA_URL="https://julialang-s3.julialang.org/bin/linux/x64/$JULIA_VERSION/julia-$JULIA_VERSION-linux-x86_64.tar.gz"

# Create a temporary directory for installation
mkdir -p /tmp/julia-install
cd /tmp/julia-install

# Download Julia tarball
wget $JULIA_URL

# Extract Julia tarball
tar -xvzf julia-$JULIA_VERSION-linux-x86_64.tar.gz

# Move Julia to /opt
sudo mv julia-$JULIA_VERSION /opt/

# Create a symbolic link for Julia binary
sudo ln -s /opt/julia-$JULIA_VERSION/bin/julia /usr/local/bin/julia

# Clean up downloaded files
rm -rf /tmp/julia-install

echo "Julia $JULIA_VERSION has been installed successfully."

Windows:

# Define the version of Julia to install
$JuliaVersion = "1.7.0"

# Define the download URL for the Julia installer
$JuliaUrl = "https://julialang-s3.julialang.org/bin/winnt/x64/$JuliaVersion/julia-$JuliaVersion-win64.exe"

# Define the location to download the installer
$DownloadPath = "$env:TEMP\julia-install.exe"

# Download the Julia installer
Invoke-WebRequest -Uri $JuliaUrl -OutFile $DownloadPath

# Install Julia silently
Start-Process -FilePath $DownloadPath -ArgumentList "/S" -Wait

# Remove the downloaded installer
Remove-Item $DownloadPath

Write-Output "Julia $JuliaVersion has been installed successfully."

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee


Reference:

  1. Julia Programming Language