Tag: install

Straightforward guides for installing and setting up Javascript tools, libraries, and projects without unnecessary complexity.

  • How to Install Java on Mac: Step-by-Step Guide

    How to Install Java on Mac: Step-by-Step Guide

    If you’ve ever tried running a Java program on a Mac without setting anything up, you’ve probably seen an error about a missing Java Runtime. That’s because, unlike JavaScript, Java doesn’t come built into your computer — you need to install a Java Development Kit (JDK) first.

    In this guide, we’ll go step by step:

    • Check if Java is already installed (so you don’t install it twice by mistake)
    • Learn what a JDK kit is and why most developers use it
    • Install Java on a Mac using either Homebrew or the official Oracle download
    • Set up your environment so the java command works anywhere in your terminal
    • Verify the installation, uninstall if needed, and fix common issues

    Whether you’re new to Java or just coming from another language like JavaScript, this guide will give you a clear path to getting Java up and running on macOS.

    Check if Java is Already Installed

    Before installing Java, it’s worth checking if it’s already on your Mac. Maybe you’re not on your personal machine, or you installed it months ago for a side project and completely forgot.

    To check if Java is already installed:

    1. Open your Terminal
    2. Type java -version
    3. If Java is installed, you’ll see something like:
    OpenJDK version 11.x
    Bash

    If it’s not installed, you’ll get a message like:

    The operation couldn’t be completed. Unable to locate a Java Runtime.
    Please visit http://www.java.com for information on installing Java.
    Bash

    If you see the “Unable to locate” message, don’t worry — just continue with this guide to install Java on your Mac.

    What is a JDK?

    If this is your first programming language, or if you’re like me, coming from another one — in my case, Javascript — you might not know much about the Java ecosystem. And honestly, you don’t really need to at first, right?

    Still, because of assumptions, you might expect the installation to be as simple as running brew install java. But when you look it up, you’ll quickly see that the recommended way is to install a JDK instead. Before we continue, let’s take a quick look at what that actually is.

    JDKJava Development Kit is an open-source implementation of Java, maintained by big tech companies such as Oracle, Red Hat, and others.

    When we refer to an open-source implementation, it simply means software built according to official rules. In this case, the rules come from the Java SE Specification.

    So what does the JDK provide? It contains:

    • Compiler – turns your .java files into an executable form called bytecode.
    • Runtime (JVM) – executes that bytecode on any computer (Windows, Mac, Linux, etc.).
    • Standard library – a huge set of built-in tools to help you out with your code.

    It essentially has everything you need to use Java on your machine. The JDK is considered an essential tool for developers working with Java, and the OpenJDK project and Oracle distribute it.

    Install Java on Mac

    You can install Java on macOS in two main ways:

    1. Install Using Homebrew – quick and beginner-friendly
    2. Install by Downloading from Oracle

    If you’re new to Java or simply want the fastest setup, the Homebrew method is the best choice. (We have a separate post that walks you through installing Homebrew if you don’t have it yet.)

    In this guide, we’ll use the Homebrew method.

    To find out which is the latest version of Java, you can visit this page.

    Install Java using Homebrew

    To install Java using Homebrew:

    1. Update Homebrew
      Open your terminal and run: brew update
      This makes sure you’re working with the latest package list.
    2. Install OpenJDK 21
      After updating, run:
      brew install openjdk@21
    3. Verify installation
      Open your terminal and run:
    java -version
    Bash

    At the time of writing this guide, version 21 is the latest long-term support (LTS) release. If you want to install a different version, just replace 21 with the version number you need (for example, openjdk@17).

    Optional: Read More About the Package
    You can check out the official Homebrew formula page for OpenJDK here.

    Set JAVA_HOME Environment Variable

    After installing OpenJDK, you could have tried to verify the installation and found out that you still get

    The operation couldn’t be completed. Unable to locate a Java Runtime.
    Please visit http://www.java.com for information on installing Java.
    Bash

    In that case, you will need to add the Java home directory to your PATH. Since we installed OpenJDK@21, the command to add this to our PATH is

    echo 'export PATH="/opt/homebrew/opt/openjdk@21/bin:$PATH"' >> ~/.zshrc
    Bash

    You’ll also see this message in the Homebrew installation logs for OpenJDK, near the end of the process.

    What this command essentially does is prepend the existing list of paths with the directory where OpenJDK is installed. So when you ask it to run a java program, it will search first there.

    If you installed a different version, change the version accordingly to the command above.

    Verify Installation

    To verify our installation regardless of the method we used we should type java --version. By now you should be seeing

      ~ java -version
    openjdk version "21.0.8" 2025-07-15
    OpenJDK Runtime Environment Homebrew (build 21.0.8)
    OpenJDK 64-Bit Server VM Homebrew (build 21.0.8, mixed mode, sharing)
    Bash

    Uninstalling Java (Homebrew)

    If you want to remove a specific version of OpenJDK installed via Homebrew, run:

    brew uninstall openjdk@21
    Bash

    Checking Installed Versions

    To see all the Java versions (and other packages) you currently have installed, run:

    brew list --versions
    Bash

    You might see something like this:

    ...
    openjdk@17 17.0.12
    openjdk@21 21.0.4
    ...
    Bash

    This means you have both Java 17 and Java 21 installed on your system.

    Choosing an IDE for Java

    Now that you’ve installed Java, the next step is picking an Integrated Development Environment (IDE) to support your learning. An IDE helps you compile code, catch mistakes, and debug programs more easily — making your path to mastering Java smoother.

    Some popular free choices include:

    • IntelliJ IDEA Community Edition, published by JetBrains. This is my personal recommendation, since it’s beginner-friendly and offers a free edition.
    • Eclipse, maintained by the Eclipse Foundation
    • NetBeans, maintained by the Apache Foundation

    Pick one of these tools, set it up, and you’ll be ready to start coding your very first Java programs with confidence!

    Troubleshooting Common Issues

    Below are some common issues you might face when installing or using Java on macOS.
    If you’re dealing with a different problem and haven’t figured out the solution, drop it in the comments — we’ll try to help you out.
    Also, if you’ve solved a tricky Java issue yourself, share it in the comments so other readers can benefit too.

    Wrong Java Version Running

    Cause: Multiple Java versions are installed, and the wrong one is first in your PATH.
    Fix: Check which Java is being used

    which java
    Bash

    Then adjust your PATH so the version you want comes first. You can do that by typing:

    export PATH="/opt/homebrew/opt/openjdk@<version-you-want>/bin:$PATH"
    Bash

    brew install fails

    Cause: Homebrew may be outdated or missing.

    Fix: Update Homebrew:

    brew update
    Bash

    If Homebrew is not installed, see our homebrew installation guide.

    java Command Not Found

    Cause: OpenJDK is installed but not linked to your environment.

    Fix: Link the installed version so the java command is available:

    brew link --force --overwrite openjdk@21
    Bash

    If you installed a different version, replace 21 with that version number.

  • How to Install Postgres on MacOS

    How to Install Postgres on MacOS

    If you’re working on a Node.js project and run into errors like ECONNREFUSED ::1:5432, chances are PostgreSQL isn’t running — or it isn’t even installed. Here’s a quick guide to install postgres on macOS using Homebrew, the most reliable and straightforward method.

    Before installing PostgreSQL, make sure you already have Homebrew installed on your Mac. Homebrew is the package manager we’ll be using to install and manage PostgreSQL.

    Don’t have Homebrew yet? No worries, we got you covered. Check out our guide: How to Install Homebrew on macOS.

    Once you’ve got Homebrew set up, you’re ready to continue.

    Step 1: Install PostgreSQL via Homebrew

    With Homebrew installed, adding PostgreSQL is easy:

    brew install postgresql
    Bash

    If you want to install a specific version of postgres, e.g, version 17 type:

    brew install postgresql@17       
    Bash

    Step 2: Start the PostgreSQL Service

    Once installed, start PostgreSQL as a background service:

    brew services start postgresql
    Bash

    To confirm it’s running:

    brew services list
    Bash

    You should see something like:

    Name        Status   User       File
    postgresql  started  your-name  Library/LaunchAgents/[email protected]
    Bash

    Step 4: Confirm the Installation

    Check that PostgreSQL is installed correctly:

    psql --version
    Bash

    psql is the interactive command-line tool when working with Postgres

    Expected output:

    psql (PostgreSQL) 17.5 (Homebrew)
    Bash

    In case you are getting a command not found: psql error you have to explicitly link it. For my example, in which i installed version 17, I just had to type

    brew link postgresql@17 --force
    Bash

    By typing psql --version you should now see the postgreSQL you just installed.


    Step 5: Connect to PostgreSQL

    You can now open a PostgreSQL shell:

    psql postgres
    Bash

    Or create your own database:

    createdb mydb
    psql mydb
    Bash

    Step 6 (Optional): Choosing a GUI

    If you prefer a graphical interface over the terminal, consider installing

    These tools make managing your databases even easier.

  • How to install Git on Mac – MacOS for beginners

    How to install Git on Mac – MacOS for beginners

    So, you’re new to macOS and ready to set up Git? Great choice! Git is one of the essential tools for developers, and installing it should be one of the first steps in your journey. Don’t worry—it’s easier than you think. Let’s get started!

    If you’ve never worked with Git before, think of it as a timeline for your files. It’s a tool used to keep track of every change you make, so you can jump backward in time if you break something or experiment freely without losing your original work.

    It’s not just for programmers — writers, researchers, and designers also use Git to track versions of their work. Installing Git on your Mac now will save you a lot of headaches later.

    Although there’s a small learning curve at first, you’ll quickly find that once you’ve used Git for a while, you can’t imagine working without it — you’ll wonder how you ever managed before.

    Check if Git is already installed

    If you’re just setting up your Mac, it’s unlikely that Git is already installed. macOS doesn’t come with a fully functional Git by default. Instead, it includes a placeholder located at /usr/bin/git. This placeholder acts as a link to the actual Git version, which gets installed with Xcode or the Command Line Tools.

    To check, open your terminal and type:

    git --version

    If you see something like:

    No developer tools were found, requesting install

    it means that macOS detected that you tried to use a command-line developer tool – git in this case – but the Xcode Command Line Tools are not installed on your system.

    From here, you have two main choices for installing Git on your Mac — Apple’s Xcode Command Line Tools or the Homebrew package manager. Both will get the job done, but they have different strengths.

    • Xcode Command Line Tools is quick and easy if you just want to start using Git right away, but the version it installs is maintained by Apple and might not always be the latest.
    • Homebrew, on the other hand, gives you more control and makes it simple to update Git whenever a new release comes out. If you plan to keep working with Git regularly, I suggest going with Homebrew for its flexibility and ease of maintenance.

    Install Git on Mac using Xcode

    Xcode is one of the quickest ways to install Git on your system. Since Xcode Command Line tools include Git in the package, to use Git all you need to do is type the following command in your terminal

    xcode-select --install

    When the pop-up appears, click Install. Make sure you’re connected to the internet.

    Once the installation finishes, confirm it by typing:

    git --version

    You should now see something like:

    git version 2.39.5 (Apple Git-154)

    Install Git on Mac using Homebrew

    Another popular way to install Git on macOS, apart from using Xcode Command Line Tools, is by using Homebrew.

    This method is often preferred by developers who want more control over the Git version or are already using Homebrew for managing other software.

    To install Git using Homebrew, run the following command

    brew install git

    Running this command will display some logs related to the Git installation, such as:

    ....
    ==> Installing git
    ==> Pouring git--2.47.1.arm64_sequoia.bottle.tar.gz
    ==> Caveats
    The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
    Subversion interoperability (git-svn) is now in the `git-svn` formula.
    
    zsh completions and functions have been installed to:
      /opt/homebrew/share/zsh/site-functions
    ==> Summary
    🍺  /opt/homebrew/Cellar/git/2.47.1: 1,685 files, 54.4MB
    ==> Running `brew cleanup git`...
    ....

    Once the installation process is complete, you can verify that Git was installed successfully by typing:

    git --version

    You should see

    git version 2.39.5 (Apple Git-154)

    With Git successfully installed, you’re now ready to dive into your development journey and take full control of your projects!

    🛠 Extra Tip: When installing via Homebrew, you can easily update Git later by running:

    brew update && brew upgrade git
    Bash

    This ensures you’re always on the latest stable release without waiting for Apple updates. It also makes switching between different Git versions simple, which is useful for testing or specific project needs.

    Verify Git configuration

    After installing Git, it’s a good idea to configure your identity so your commits are linked to the right name and email address. Run the following commands in your terminal:

    git config --global user.name "Your Name"
    git config --global user.email "[email protected]"
    Bash

    You can check your saved settings with:

    git config --list
    Bash

    This will show your username, email, and other configuration details. These can be changed at any time if you switch accounts or need to adjust your settings.

    Next Steps with Git

    Installing Git is just the beginning. The next step is learning a few key commands that will make you productive right away. Start with:

    • git init – Create a new repository in the current folder.
    • git add <filename> – Stage files you want to include in your next commit.
    • git commit -m "message" – Save your staged changes with a short description.
    • git status – Check what’s been modified, staged, or committed.
    • git log – View a history of all commits in the repository.

    Once you’re comfortable with these, try creating a branch with git branch <branchname> and switching to it using git checkout <branchname>. Branching is one of Git’s most powerful features, letting you work on new ideas without touching your main project until you’re ready.

    As you explore these commands, remember that consistent practice is the fastest way to build confidence and skill with Git. And if you want to take things a step further, tools like Husky pre-commit hooks can help automate checks and streamline your workflow as you grow.


  • How to install Homebrew – MacOS for beginners

    How to install Homebrew – MacOS for beginners

    If you are making your first steps on macOS, you may have never heard of Homebrew before. Homebrew is a powerful package manager, similar to npm if you’ve worked with it before. It allows you to easily install, update, and remove software packages directly from your terminal, making it an incredibly handy tool for developers. In this post, you’ll find a step-by-step guide to install Homebrew on MacOS.

    Why is it essential to install Homebrew?

    Homebrew is widely regarded as the most popular package manager for macOS. It’s the go-to choice for developers and power users because of its simplicity and active community support.

    Homebrew lets you easily get the tools and libraries you need for development or daily tasks, from developer tools like Git and Node.js to simple everyday utilities. It saves time by skipping the trouble of manual downloads and setup. It’s simple, fast, and perfect for customizing your Mac.

    If you haven’t used a tool like Homebrew before, don’t overlook it – it could completely transform the way you manage software on your Mac.

    Check if Homebrew is already installed

    Just to make sure you haven’t already installed Homebrew in the past, let’s check it out. Open your terminal and type:

    brew help

    If you have it installed, you should see something like

    Example usage:
      brew search TEXT|/REGEX/
      brew info [FORMULA|CASK...]
      brew install FORMULA|CASK...
      brew update
      brew upgrade [FORMULA|CASK...
      ....

    otherwise, you will get the following result

    command not found: brew

    How to install Homebrew

    Ready to install Homebrew? Here’s everything you need to know. Open your terminal (Cmd + Space and type Terminal“) and type

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

    Oh, you say! What is this command? Let me explain. This command asks bash (which is a command-line shell language commonly used in macOS and Linux) to execute a script.

    Here’s how it works:

    • /bin/bash: specifies the bash shell, ensuring the command is executed using bash, even if your default shell is something else (like zsh).
    • -c: This flag tells bash to execute the command provided in quotes.
    • $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh): This part fetches the Homebrew installation script directly from GitHub using curl (a tool for transferring data).

    In simple terms, this command downloads the Homebrew installer script from GitHub and immediately runs it using bash to set up Homebrew on your system.

    You will be asked for your super user password:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    Checking for `sudo` access (which may request your password)...
    
    Password:
    

    After typing your password, you’ll see a message prompting you to press ENTER to proceed with the installation. Simply press ENTER, and the installation will continue.

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
    Checking for `sudo` access (which may request your password)...
    
    Password:
    
    ==> This script will install:
    /opt/homebrew/bin/brew
    /opt/homebrew/share/doc/homebrew
    ....
    /opt/homebrew
    ==> The following new directories will be created:
    /opt/homebrew/bin
    /opt/homebrew/etc
    /opt/homebrew/include
    ....
    /opt/homebrew/Frameworks
    
    Press RETURN/ENTER to continue or any other key to abort:

    Wait for the installation process to complete—it may take a few minutes. Once it’s done, you’ll see the message “Installation successful!”. However, to ensure everything was installed correctly, let’s verify it by typing the following command in the terminal:

    brew help

    If it was successfully installed, you should see the following response.

    Example usage:
      brew search TEXT|/REGEX/
      brew info [FORMULA|CASK...]
      brew install FORMULA|CASK...
      ....

    Homebrew doesn’t work after installing it

    If you’ve already followed all the steps described to install Homebrew but see a “command not found” error when running, e.g., brew help it typically means that the Homebrew binary is not properly added to your system’s PATH.

    To resolve the issue, revisit the logs from the Homebrew installation script. At the end of the script, you’ll typically find specific instructions for finalizing the installation.

    Warning: /opt/homebrew/bin is not in your PATH.
      Instructions on how to configure your shell for Homebrew
      can be found in the 'Next steps' section below.
    ==> Installation successful!
    ...
    ...
    ...
    ==> Next steps:
    - Run these commands in your terminal to add Homebrew to your PATH:
        echo >> /Users/<your username>/.zprofile
        echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/<your username>/.zprofile
        eval "$(/opt/homebrew/bin/brew shellenv)"

    copy the last part of the Homebrew installation instructions —starting from the command that begins with echo — and paste it into your terminal. This command typically adds Homebrew to your system’s PATH.

    By now, you should have Homebrew installed on your system successfully. Congratulations! This is just the first small step on your exciting journey to mastering powerful tools and workflows as you grow your skills.If you’re exploring ways to automate parts of your development workflow next, you might find Git tools like Husky pre-commit hooks especially helpful.

  • How to Install npm on MacOS

    How to Install npm on MacOS

    Installing Node.js and npm (Node Package Manager) on your Mac is super simple. With these tools, you can manage Javascript packages, create powerful web applications, and dive deep into modern web development. Start by following these steps:

    Step 1: Verify that npm is installed

    Open your terminal and type

    node -v
    npm -v
    Bash
    • If you see version numbers (e.g., v16.13.0 for Node.js and 8.1.0 for npm), they’re already installed.
    • If you see errors or no versions, continue to the next step.

    Step 2: Install Node.js (includes npm)

    The easiest way to install Node.js and npm is by using Homebrew. If you don’t have Homebrew installed, install it first.

    Then run:

    brew install node
    Bash

    Step 3: Verify the Installation

    After the installation completes, type the following command to check the versions and ensure everything is installed properly:

    node -v
    npm -v
    Bash

    You should see version numbers for both. 🎉

    Step 4: Update npm (Optional)

    npm updates frequently, so ensure you have the latest version:

    npm install -g npm@latest
    Bash

    🎉 You’re all set! Now, you can use Node.js and npm to manage and build amazing projects. Happy coding! 😊

    Why Use Node.js and npm?

    • Fast & Scalable: Node.js enables fast, scalable network applications with non-blocking I/O.
    • Massive Ecosystem: npm offers access to over 1 million open-source packages.
    • Cross-Platform: Develop once and deploy anywhere.

    These tools are essential for any web developer aiming to build modern, high-performance applications.