Enabling Command-Line Pipe for Atom on OS X

Pipe to Atom Command-Line Tools

This allows you to pipe from the command line to Atom. Simplest example:

ls -l | atom

Set It Up

Make sure you've run File -> Install Shell Commands first.




Edit your /usr/local/bin/atom (in Atom, for instance):

atom /usr/local/bin/atom

Below this code:

if [ $REDIRECT_STDERR ]; then
exec 2> /dev/null
fi

insert this code

if [ ! -t 0 ]; then
TEMPFILE="$(mktemp)"
cat > "$TEMPFILE"
set "$TEMPFILE" "$@"
fi

Save the file and now piping should work.

This comment is also on GitHub here.


2018-02-15: Update
This does tend to break from time to time (perhaps on Atom update?). You'll need to reapply.


* osx os x macos