Alex
Alex

Reputation: 1177

Updating Make Version on Mac

I'm trying to update the version of make on my mac but am running into issues. The minimum project dependency is 4.1 but my version seems to be 3.81. I've updated Xcode to the latest version and installed the command line tools but it still seems to be the older version.

Has anyone run into this issue or know of a way to resolve it?

Upvotes: 37

Views: 43684

Answers (5)

Ricardo Mutti
Ricardo Mutti

Reputation: 2959

None of the folders from the answers above worked for me, but running brew info make outputted the correct one, then I just added to the path.

Folder that worked for me (OS Ventura 13.2.1): PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"

enter image description here

Upvotes: 1

Dr. Octopus
Dr. Octopus

Reputation: 191

If you choose the homebrew method, you should use brew info make after brew install make succeeds. Then you will see a text like this:

If you need to use it as "make", you can add a "gnubin" directory to your PATH from your bashrc like:
PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"

So, add this path in your .bash_profile,The detailed steps as:

  1. open ~/.bash_profile
  2. Add line: export PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"(the path you just got)
  3. S
  4. source ~/.bash_profile

Upvotes: 9

Firstly, the current version:

$ make --version                  
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

Steps to install/configure:

brew install make
export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"

Result:

$ make -v
GNU Make 4.3
Built for x86_64-apple-darwin19.6.0
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Upvotes: 18

Patrick
Patrick

Reputation: 867

Here is what I did, and it works on my MacOS:

Step1: Install homebrew (installation command comes from https://brew.sh/):

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Step2: Use homebrew to install make

brew install make --with-default-names

just incase it doesn't work, try this:

brew install homebrew/dupes/make --with-default-names

Step3: You need to change the default command to use correct make instead of the default one from your MacBook or Mac.

For example, if you type

make --version

You will see:

GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

Which is the default path for default version.

So, now, in your .bash_profile (which should be under your home dir /Users/your_name), add the following line:

export PATH="/usr/local/bin:$PATH"

Note: If you see the following message when you installed make:

GNU "make" has been installed as "gmake". If you need to use it as "make", you can add a "gnubin" directory to your PATH from your bashrc like:

PATH="/usr/local/opt/make/libexec/gnubin:$PATH"

then instead run,

export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"

Then source your .bash_profile. Now try to check your version:

make --version

It should show:

GNU Make 4.2.1
Built for x86_64-apple-darwin16.5.0
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later     <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Cheers.

Upvotes: 48

Lame Duck
Lame Duck

Reputation: 11

I attempted a fix by a different approach, namely downloading the newer version of GNU Make I want to upgrade into compile that from source downloaded from the official GNU link, instead of using homebrew. Then, on my mac, I added a path to my bash shell:

export PATH=/usr/local/bin

to the ".bashrc" file in my $HOME directory.

Then reset my Terminal. And, it worked. There seems to be some issue with the homebrew download because the formula automatically links the "gmake" installation to the wrong bin, or more accurately missing the bin in the /usr/local/Cellar/etc./path. So I reckon that's probably why it does not work as of now. Hope maybe someone will fix that soon.

Upvotes: 0

Related Questions