codelessgenie blog

How to Install Julia on macOS: A Comprehensive Guide

Julia is a high-level, high-performance dynamic programming language designed for technical computing, blending the ease of use of Python with the speed of C. It’s ideal for data science, machine learning, scientific computing, and general-purpose programming, making it a popular choice among macOS users.

This guide walks you through multiple reliable installation methods, post-installation setup, verification, best practices, and troubleshooting. Whether you prefer package managers, official binaries, or version managers, we’ve got you covered.

2026-07

Table of Contents#

  1. Prerequisites
  2. Installation Methods 2.1 Using Homebrew (Package Manager) 2.2 Official Binary from JuliaLang.org 2.3 JuliaUp (Official Version Manager) 2.4 Using MacPorts
  3. Post-Installation Setup
  4. Verifying Your Julia Installation
  5. Basic Example Usage
  6. Best Practices for Julia on macOS
  7. Troubleshooting Common Issues
  8. Conclusion
  9. References

1. Prerequisites#

Before installing Julia, ensure your system meets these requirements:

  • macOS Version: Julia 1.9+ requires macOS 10.13 (High Sierra) or later. For Apple Silicon (M1/M2/M3), use native ARM64 builds for optimal performance.
  • Shell Access: Use the Terminal app (Applications > Utilities) for command-line operations. macOS Catalina and later use Zsh by default; earlier versions use Bash.
  • Optional: For package manager methods, install Homebrew or MacPorts (instructions included below).

2. Installation Methods#

2.1 Using Homebrew (Package Manager)#

Homebrew is the most popular package manager for macOS, simplifying software installation and updates.

Step 1: Install Homebrew (if not installed)#

Run this command in Terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Verify installation:

brew --version

Step 2: Install Julia#

brew install julia

Step 3: Update or Uninstall Julia#

  • Update: brew update && brew upgrade julia
  • Uninstall: brew uninstall julia

2.2 Official Binary from JuliaLang.org#

Download the official DMG for direct control over installation.

Step 1: Download the DMG#

  1. Go to the Julia Downloads page.
  2. Choose the appropriate DMG:
    • Apple Silicon: ARM64 build
    • Intel: x64 build
  3. Save the DMG file (e.g., Julia-1.9.3-mac64.dmg).

Step 2: Install to Applications#

  1. Open the DMG file. Drag the Julia icon to the Applications folder.
  2. Close the DMG window after installation.

Step 3: Add Julia to PATH#

To access Julia from Terminal, add its binary directory to your shell configuration:

  • Zsh (default):
    nano ~/.zshrc
    Add this line (replace 1.9.3 with your version):
    export PATH="/Applications/Julia-1.9.3.app/Contents/Resources/julia/bin:$PATH"
    Save and apply changes:
    source ~/.zshrc
  • Alternative: Symlink Create a symlink to /usr/local/bin (already in PATH):
    ln -s /Applications/Julia-1.9.3.app/Contents/Resources/julia/bin/julia /usr/local/bin/julia

2.3 JuliaUp (Official Version Manager)#

JuliaUp is the official version manager, similar to rustup for Rust. It’s recommended for managing multiple Julia versions seamlessly.

Step 1: Install JuliaUp#

Run this command in Terminal:

curl -fsSL https://install.julialang.org | sh

JuliaUp automatically adds itself to your PATH.

Step 2: Install and Configure Julia#

  • Install the latest stable version:
    juliaup install stable
  • Set as default:
    juliaup default stable

Step 3: Manage Multiple Versions#

  • Install an LTS version: juliaup install 1.8
  • Switch to LTS temporarily: juliaup use 1.8
  • Update all versions: juliaup update
  • List installed versions: juliaup list

Step 4: Uninstall JuliaUp#

juliaup self uninstall

2.4 Using MacPorts#

MacPorts is an alternative package manager for macOS.

Step 1: Install MacPorts#

  1. Download the installer from the MacPorts website.
  2. Run the installer and follow prompts.

Step 2: Install Julia#

sudo port install julia

Enter your admin password when prompted.

Step 3: Update Julia#

sudo port selfupdate && sudo port upgrade julia

3. Post-Installation Setup#

Install Common Packages#

Add popular packages like IJulia (Jupyter notebooks) and DataFrames (data manipulation):

  1. Open the Julia REPL: julia
  2. Enter package mode with ], then run:
    add IJulia DataFrames
  3. Exit package mode with Backspace or Ctrl+C.

Configure Startup Script#

Customize Julia's behavior with a startup script at ~/.julia/config/startup.jl. For example:

atreplinit() do repl; repl.prompt = "Julia> "; end

4. Verifying Your Julia Installation#

Check Version#

julia --version

Expected output: julia version 1.9.3

Launch the REPL#

Type julia in Terminal. You’ll see:

               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]" for Pkg.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.9.3 (2023-08-24)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia>

Run a Test Program#

println("Hello, Julia!")
# Output: Hello, Julia!
 
sum(x^2 for x in 1:1_000_000)
# Output: 333333833333500000

5. Basic Example Usage#

Data Manipulation with DataFrames#

# Activate a local project environment
using Pkg
Pkg.activate("./my_project")
Pkg.add("DataFrames")
 
using DataFrames
 
# Create a DataFrame
df = DataFrame(
    Name = ["Alice", "Bob", "Charlie"],
    Age = [25, 30, 35],
    City = ["New York", "London", "Paris"]
)
 
# Filter rows where Age > 28
filtered_df = filter(row -> row.Age > 28, df)
println(filtered_df)

Jupyter Notebook with IJulia#

using IJulia
notebook() # Opens Jupyter in your browser

Shell Commands in REPL#

Prefix shell commands with ;:

; ls -l # Lists directory contents

6. Best Practices for Julia on macOS#

  1. Use JuliaUp: It’s the official, recommended way to manage versions and updates.
  2. Local Environments: Use Pkg.activate(".") for each project to avoid dependency conflicts.
  3. Precompile Packages: Speed up startup with Pkg.precompile() or Pkg.precompile("DataFrames").
  4. Apple Silicon Optimization: Use native ARM64 builds for better performance.
  5. Keep Julia Updated: Regularly update via your chosen method to access new features and bug fixes.

7. Troubleshooting Common Issues#

"command not found: julia"#

  • Ensure Julia’s binary directory is in your PATH (follow Section 2.2 or 2.3 steps).
  • For JuliaUp, re-run the installation command to fix PATH issues.

Permission Errors When Installing Packages#

  • Use local project environments (Pkg.activate(".")) instead of global installation.
  • Avoid running Julia with sudo (can cause long-term permission issues).

Slow Startup Time#

  • Reduce global packages by using local environments.
  • Precompile packages with Pkg.precompile().
  • Use PackageCompiler.jl to create a custom sysimage for large projects.

8. Conclusion#

Installing Julia on macOS is flexible, with options for every user. JuliaUp is the best choice for most users due to its version management capabilities. Homebrew or MacPorts are great for package manager enthusiasts, while the official DMG offers direct control.

With Julia installed, you can leverage its speed and simplicity for data science, scientific computing, and more. Follow best practices to ensure a smooth, productive experience.


9. References#