Updating Make Version 4.1 on Mac

前端 未结 2 1457
甜味超标
甜味超标 2020-12-15 08:42

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

相关标签:
2条回答
  • 2020-12-15 09:22

    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.

    0 讨论(0)
  • 2020-12-15 09:27

    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.

    0 讨论(0)
提交回复
热议问题