Skip to content

wrapper script for running Linux bash scripts on OSX/BSD

License

Notifications You must be signed in to change notification settings

noctuid/with-gnu-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

https://github.com/noctuid/with-gnu-utils/workflows/lint/badge.svg

About

This is a wrapper script for running bash scripts that were written for Linux on OSX/BSD. This script can be used on either Linux or OSX/BSD. On Linux, it will do nothing and just call the specified program/script. On OSX/BSD it will first define functions to ensure that the GNU versions of commands are used.

Here is an example invocation to run tdrop:

with-gnu-utils tdrop -ma -s dropdown kitty

Requirements

OSX

Install these with brew:

  • bash
  • coreutils
  • gawk
  • findutils
  • grep
  • gnu-sed
  • gnu-tar
  • gnu-getopt

FreeBSD

Install these:

  • bash
  • coreutils
  • gawk
  • findutils
  • gnugrep
  • gsed
  • gtar
  • getopt

OpenBSD

Install these:

  • coreutils
  • gawk
  • findutils
  • ggrep
  • gsed
  • gtar

Caveats

GNU getopt is not installeable on FreeBSD and OpenBSD as far as I can tell. On FreeBSD, there is a version of getopt that is more compatible with GNU getopt.

procps pgrep is also not available on BSD, so scripts that use flags that are only available in procps pgrep will not work either.

If other unavailable commands used, the script may not work (e.g. this script won’t magically make xdotool work if you are not running X). This script only handles differences in core utilities.

Use with makem.sh

with-gnu-utils can be used to run makem.sh on FreeBSD or OSX (but not OpenBSD). Either copy the with-gnu-utils script into your repository or add this repository as a submodule. Install the necessary dependencies listed above and then run makem.sh through with-gnu-utils:

# if copied script into repository
./with-gnu-utils \
	./makem.sh -vv -S ./sandbox --install-deps --install-linters
# if using submodules
./with-gnu-utils/with-gnu-utils \
	./makem/makem.sh -vv -S ./sandbox --install-deps --install-linters

This allows doing CI testing on an OSX machine, for example. See general.el’s Makefile and test.yml.

About

wrapper script for running Linux bash scripts on OSX/BSD

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages