How to install BSD make on a Mac (while preserving GNU make)? - macos

I have two questions regarding make on my Mac: one regarding installation of a second make flavor, the second regarding how to manage the two flavors.
I need to install BSD make on my Mac, but I don't want to remove the GNU make that is standard on the Mac; Berkeley is for a special project. In spite of the extensive resources for installing BSD, I haven't been able to figure out where to get and how to install that single program. What is the best way to do this?
I'm thinking that I'll need to put it in /usr/local/bin while GNU make, which was provided by the Mac OS developer tools, will stay where it is in /bin. Then I can manage which make is called with an alias. I'm still a *nix newbie; is this a reasonable strategy or is there a better way?

Installing BSD make
If you don't already have a /usr/bin/bsdmake (apparently it used to come with OS X/Xcode, but no longer does), install Homebrew, then:
brew install bsdmake
GNU co-habitation
To avoid conflicts with GNU make, Homebrew will install BSD make as bsdmake. In most cases it should be sufficient to build your software with bsdmake all. Sometimes you may have to tell it that your BSD make is called bsdmake and not make.
Removal
If you decide to get rid of BSD make for whatever reason, Homebrew will be happy to clean up for you by invoking:
brew uninstall bsdmake

Install macports and then use it to install bsdmake or bmake. They will be installed into /opt/local/bin (you will have to adjust your $PATH within your ~/.profile to access them easily).

Related

macOS Package Managers: Using Nix alongside Homebrew?

I was wondering if there would be any issues with installing Nix and Homebrew on the same system?
I know Homebrew tends to install things all over different directories, but from what I have read, Nix is very clean. If I understand this correctly, Nix installs it's packages all within one single directory.
So if this is the case, could I try running them both side-by-side? I would be careful not to install too many of the same packages from both places in (ie. I wouldn't install grep, htop, or whatever else from both Homebrew and Nix and if I did I would take precautions).
Side-note: This would not be permanent. I am thinking about switching from Homebrew to Nix (just to mix things up a bit), and I wanted to try Nix on my main machine before taking the leap (if at all). I know I could just try Nix on a VM, but I would not get the same experience unless I tried it on my main system. So it would be nice to install it along Homebrew and give it a shot before going through the pains of removing Homebrew and replacing all my Homebrew packages with Nix packages.
Yes, you can install Nix along side Homebrew.
Nix will install all it's packages within /nix/store For example, on my NixOS system vim is currently installed in /nix/store/j6nrk9h1rpxrzmccm0yq520ik625gd1q-vim-8.1.0578
Your shell will choose whether to use a package from Nix or Homebrew, according to how $PATH is set up. For example, if it so happens that the Nix paths are first, then they will take precedence.
Note
A common source of confusion is that install means something different on Nix. When you install a package, such as Python, it becomes part of a Nix environment, and as such can be executed without specifying the full path; Just as you'd expect from any package manager.
However, if you install a package which has, say, Python, as a dependency, Python would get installed, but more likely than not it would not be included in the environment. Hence it can only be executed via the absolute path.
On a related note, due to a similar reason, if you install a library with Nix and then try to compile against it outside of Nix, it will not work; The build tools will not find the library.

Installing gnu plot for macOS High Sierra

How does one install a runnable version of gnu plot in macOS high Sierra?
I am looking for a way to make this work with the GUI, but even just getting the terminal script to run would be a success.
Thanks!
The Brew implementation of gnuplot is not really usable because it no longer supports the necessary terminals (e.g., you can no longer provide --with-aquaterm or --with-x11 during installation).
However, the MacPorts package manager has a usable install for gnuplot (it's safe to have both Brew and MacPorts installed). https://www.macports.org/
After intalling AquaTerm, I used the following to install gnuplot, and all is working as expected:
sudo port install gnuplot +aquaterm
I'm using macOS Mojave 10.14.4.
It's easy enough with homebrew.
First, install Xcode command line tools:
xcode-select --install
Then install homebrew by going to homebrew website and copying and pasting the one-liner installation script. I don't want to paste that line here in case it changes down the line, so get the latest from the homebrew website.
Now you have a full package manager that allows you to find, install, update and delete thousands of packages. So you can easily find gnuplot or anything else with:
brew search gnuplot
Once you have found your package, check the avaiable options with:
brew options gnuplot
Sample Output
--with-aquaterm
Build with AquaTerm support
--with-cairo
Build the Cairo based terminals
--with-qt
Build with qt support
--with-wxmac
Build wxmac support. Need with-cairo to build wxt terminal
--with-x11
Build with x11 support
Now install with some sensible options for graphical plots:
brew install gnuplot --with-qt --with-x11
Always ensure your PATH starts with /usr/local/bin for homebrew since that is where it installs programs. I put the following in $HOME/.profile. And I also set the GNUTERM environment variable:
export PATH=/usr/local/bin:$PATH
export GNUTERM=qt
Now run gnuplot:
gnuplot
Sample Run
Check out many useful packages, a nice new Python not Apple's old v2.7, a nice Linux-compatible sed not Apple's BSD version, a nice grep, a nice find, the brilliant GNU awk, ImageMagick, tmux, GNU Parallel, jhead, Poppler, exiftool, Mosquitto, pdfgrep, pngcrush, ZeroMQ... the list goes on...
#David Atri: gnuplot is not as standalone as you might think. Try to compile it from source and you will see how many options and dependencies it has.The main challenge in MacOSX is to get the PDF drivers running. The fact that you see many things as standalone is the good integration work made by the developers
brew is no longer support options.
You can still do "brew install gnuplot", but it will install with just the terminals that the person who wrote the homebrew formula wanted, not necessarily the ones you want.
Compiling gnuplot from the sources is still a nightmare, so you live with the brew-formula writer's choices, write your own brew formula (not completely trivial), or you struggle with huge pile of dependencies and try to compile from the sources.

Installing Ruby on AIX

What are some less painful ways to install Ruby on AIX?
I found out that using RVM to install Ruby might be the best option. However, installing RVM itself seems like really maddening. I found an article from IBM website on how to install RVM but there are so many prerequisites for it that I feel like it will take me days to get all that stuff installed and get working:
However, RVM does have some prerequisites. Before you continue, check your system and be sure that you have the bash, git, tar, curl, gunzip, and bunzip2 utilities installed locally. In addition, your system must have the Readline, IConv, zLib, OpenSSL, and Autoconf packages to build the Ruby interpreters. You must have the Bash shell to install RVM, but you can use RVM with the Z shell version 4.3.5 or higher after RVM is installed. git is required to automatically update RVM, and this is explained shortly.
I looked up git and it has at least 10 prerequisites (includes Python which I know has tons of prerequisites as well).
Is there any way I can install all those prerequisites in once?
http://www.ibm.com/developerworks/aix/library/au-aix-manage-ruby/
I managed to get this done a couple of years ago (ruby 2.0.0).
I installed by compiling it from source as I did not have root access and wanted to install it in an afs directory anyway.
Here is my SO question and the my answer to my own question:
How do I configure ruby to compile in 64 bit mode on AIX
Here are some notes I had on how to do this as well.
if I recall using /usr/bin/ksh93 provided a huge speedup, I for get the details as to why, but using the default ksh installed on our servers was painfully slow.
export LIBPATH=/usr/lib
export CONFIG_SHELL=/usr/bin/ksh93
export OBJECT_MODE=64
./configure --enable-shared --enable-load-relative --disable-install-doc --prefix=your_install_path_here --exec-prefix=your_install_path_here/aix CC="gcc" CFLAGS="-maix64 -mminimal-toc" CXX="g++" CXXFLAGS="-maix64 -mminimal-toc" NM="nm -X64" AR="ar -X64" LDFLAGS="-maix64 -Wl,-bbigtoc" EXTLDFLAGS="-maix64 -Wl,-bbigtoc" DLDFLAGS="-shared -maix64 -Wl,-bbigtoc"
I would like to install a new version but this was really painful at the time.
Update
Another less painful way to use ruby on AIX is to install JRuby. I have done that as well, and make use of it for gui's via SWT. The biggest downside with JRuby is that it has to spin up a JVM, which takes some time. This is not a big deal for long running programs, but for short scripts it can be noticeable

How do I install ack on OS X (10.8.4)?

I am new to OS X and I am unable to figure out how to install ack. The instructions here didn't help, because the command "install" is failing. Please guide me proper commands.
So far, I have downloaded ack 2.04 and placed it in the /usr/bin folder and then ran perl Makefile.PL successfully. The next command install isn't working for me.
If you use Homebrew you can simply do:
$ brew install ack
If you are new to OSX I highly recommend this approach because it makes installation of stuff like this MUCH easier. It is a package manager for OSX.
Homebrew link: http://brew.sh/
You can also use the MacPorts installer for OSX:
sudo port install p5.<nn>-app-ack
where <nn> is the version of your Perl installation (Ack is written in Perl). If you don't know the version of Perl you have installed, just type:
perl --version
and you'll know what you need for the port command. The Ack installation page has the information you need for this. More information about MacPorts can be found here.
Searching the web, you'll find LOTS of opinions about Homebrew versus MacPorts. I've used both; they both work (and both fail occasionally - installation of this kind is complex). You'll need to pick one or the other and stick with it as Homebrew doesn't play nicely with MacPorts (or vice versa, depending on your POV). Overriding choice for me is MacPorts as it has many more packages than Homebrew and it puts its stuff in /opt/local to stay out of the way of other programs. YMMV

How to update m4, autoconf, automake and libtool properly? Mac OSX

Hej everyone,
I'm trying to update my autoconf since I need version 2.62 or newer and Mac OSX 10.6.8 only provides the old 2.61. (Eventuall, I am trying to install the SAGA-GIS API).
I followed these instructions: http://www.mattvsworld.com/blog/2010/02/install-the-latest-autoconf-and-automake-on-mac-os-10-6/
But: Whenever I work these steps through, nothing is done.
make install-recursive
Making install in .
make[5]: Nothing to be done for `install-exec-am'.
make[5]: Nothing to be done for `install-data-am'.
I installed the tools in usr/bin since this is where the old tool lay. Is this correct?
Thanks for your support, I really need this SAGA-GIS but these tools should be up to date anyway, I guess!
You should use macports as this provides a easy to use interface that can be updated pretty much like a FreeBSD distro, using a single command.
You shouldn't install into /usr/bin; that's a very bad idea; instead use /usr/local (macports actually uses /opt/local) and just ensure that your $PATH has /usr/local/bin:/opt/local/bin:/usr/bin so your newer versions are used instead.

Resources