Skip to content

macOS Setup.md

Shubham Sourabh edited this page Apr 14, 2025 · 1 revision

Neovim Setup Guide for macOS

This guide details the steps to set up the Neovim configuration from this repository on macOS.

Prerequisites

Before linking the configuration, ensure you have the following installed, primarily using Homebrew:

  1. Homebrew: The essential macOS package manager. Install it if you haven't already.
  2. Neovim: Latest stable version (0.9+).
    brew install neovim
  3. Git: Required for cloning this repository and for lazy.nvim. Usually comes with Xcode Command Line Tools, or install via brew install git.
  4. C Compiler & Build Tools: Essential for nvim-treesitter. Installing Xcode Command Line Tools usually suffices.
    xcode-select --install 
    (If that fails, you might need the full Xcode from the App Store, but try the command line tools first). Verify clang or gcc is available.
  5. Java Development Kit (JDK):
    • JDK 21 (or newer): Required to run the jdtls Language Server.
      brew install openjdk@21
      # You might need to symlink it for system use if brew doesn't do it:
      # sudo ln -sfn /opt/homebrew/opt/openjdk@21/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-21.jdk
      # Verify 'java -version' points to 21+ or configure the path explicitly in init.lua if needed.
    • Target JDK(s): Install JDKs for your projects (e.g., brew install openjdk@8). Use /usr/libexec/java_home -V to list installed JDKs and potentially set JAVA_HOME in your shell profile (.zshrc, .bash_profile).
  6. Python: Install Python 3.x via Homebrew.
    brew install python3
    Ensure python3 and pip3 are available.
  7. Nerd Font (Recommended): For UI icons.
    brew tap homebrew/cask-fonts
    brew install --cask font-YOUR-NERD-FONT-NAME # e.g., font-hack-nerd-font
    Configure your terminal emulator (e.g., iTerm2, Terminal.app) to use the installed Nerd Font.
  8. External Tools (Recommended):
    brew install ripgrep  # rg
    brew install fd       # fd
    brew install p7zip    # 7z (needed by mason.nvim for some packages)

Setup Steps

  1. Clone this Dotfiles Repository:

    git clone <URL_OF_YOUR_DOTFILES_REPO> ~/dotfiles
    # Replace <URL_OF_YOUR_DOTFILES_REPO> and choose a local path (e.g., ~/dotfiles)
  2. Backup/Remove Existing Neovim Config:

    • Neovim's configuration typically lives at ~/.config/nvim.
    • If this directory exists, rename or delete it. Make a backup first!
      # Optional: Backup existing config
      mv ~/.config/nvim ~/.config/nvim.bak
  3. Create Symbolic Link:

    • Use the ln -s command to link the location Neovim expects (~/.config/nvim) to the configuration within your cloned repository:
      ln -s ~/dotfiles/mac/nvim ~/.config/nvim
      # IMPORTANT: Adjust ~/dotfiles/mac/nvim if you cloned the repo elsewhere or use a different structure.
  4. Launch Neovim:

    • Run nvim in your terminal.
  5. Install Plugins & Tools:

    • On the first launch, lazy.nvim should automatically start cloning plugins. Wait for this to complete.
    • Run :Lazy sync to ensure everything is up-to-date.
    • Run :checkhealth to verify the setup. Address any critical errors. Ensure the C compiler (clang or gcc) is found.
    • Run :Mason to check the status of LSPs (jdtls, pyright) and formatters. Install any missing required tools.
    • Treesitter parsers for Java and Python should install automatically. Check with :TSInstallInfo.

OS-Specific Notes

  • Compiler: Xcode Command Line Tools (xcode-select --install) usually provide clang, which Treesitter should find.
  • JDK Management: Ensure the JDK 21+ found by brew install openjdk@21 is the one java points to, or add a specific handler in init.lua (similar to Windows/Linux) to point jdtls directly to the executable path (e.g., /opt/homebrew/opt/openjdk@21/bin/java).
  • Clipboard: macOS clipboard integration with Neovim usually works out of the box (pbcopy/pbpaste).

Navigation



Status

Work in Progress 🚧

Clone this wiki locally