Comments (1)
macOS uses the BSD version of sed, which differs in many respects from the GNU sed version that comes with Linux distros.
If you need to support BOTH platforms, there are two solutions:
1- restrict your sed scripts to what BSD sed supports, they will generally work in GNU sed too - with the notable exception of using platform-specific extended regex features with -E
.
checking current sed script, I can spot these Incompatible features:
- Use of the
-i
option without an argument (in-place updating without backup) is incompatible. in BSD sed it MUST use-i ''
which won't work on GNU sed. This can be easily adapted to work on both platforms, e.g, using a backup) - OS X's sed / BSD sed doesn't support
-z
(--null-data
). - The BSD implementation of sed additionally does not support \b as a word boundary pattern. it uses
[[:<:]]
and[[:>:]]
instead. \n
will be treated literally within a replacement string.
it may be possible but it is a headache to find a syntax that would run flawlessly on both platforms, in the meantime, there is an easier solution.
2- the other option is to use homebrew to install GNU version of sed for MacOS
brew install gnu-sed
export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
then it would work just fine as it works on Linux, tested. running make runv
would succeed in macOS 10.15 after installing gnu-sed. note that the commands above add gnu-sed to PATH only temporally to make it the default sed command so you can run the make scripts. closing the shell have the effect of restoring BSD sed as the default one.
from crpgp.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crpgp.