Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Choosing a different executable in bash

When I want to run make to generate some executables it always uses the Sun make located at /usr/local/bin/make rather than GNU make which can be found at /usr/sfw/bin/gmake.

How can I tell the OS to use GNU make rather than Sun's? Do I need to overwrite the path somehow?

like image 406
Mike Avatar asked Jul 26 '26 19:07

Mike


1 Answers

For two executables named identically, reorder paths in the PATH variable, since the first match will be used.

Otherwise, define an alias in your ~/.profile or ~/.bashrc file:

alias make="/usr/sfw/bin/gmake"

Or a function:

make() { /usr/sfw/bin/gmake "$@"; }

Note, that aliases work only in interactive mode. Scripts will not see them. Use functions in such case.

like image 168
Michał Šrajer Avatar answered Jul 28 '26 12:07

Michał Šrajer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!