force sips command to write output to stdout
The sips
utility does not support outputting to stdout unfortunately, so you cannot directly pipe the resulting file into another program. And as you have already tested, it also does not support using /dev/stdout
or a named pipe or similar, as it will recreate the file when outputting.
However, you can use ordinary shell scripting "tricks" to make a "one-liner" for combining the commands if you wish to do so:
sips -s format png test.icns -o __$$ && base64 __$$ && rm __$$
Note that this is for Bash, and that it will create and delete a temporary file named __.
Also note that I have removed the -w0
parameter in your question from the base64
command. That is a parameter you would use on for example the Linux version of the base64
command, but the macOS command does not have such a parameter. Indeed that wrapping behaviour you request with that parameter is already on by default on macOS.