Do you want to display some code in a Keynote presentation?

It's easy. All you need is Homebrew installed.

First you need to install the program highlight.

$ brew install highlight

So you have a piece of code. For example some Python code. The take that snippet of code and save it to a file like code.py. Now all you need to do is run this:

$ highlight -O rtf code.py | pbcopy

Then, switch back into Keynote and simply paste.

But if you don't want to create a file of the snippet, simply copy the snippet from within your editor and run this:

$ pbpaste | highlight -S py -O rtf | pbcopy

The -S py means "syntax is py (for python)".

You can use highlight for a bunch of other things like creating HTML. See man highlight for more tips.

Your email will never ever be published.

Previous:
How I back up all my photos on S3 via Dropbox August 28, 2014 Photos
Next:
set -ex - The most useful bash trick of the year August 31, 2014 Linux
Related by category:
html-getter - A powerfully simple HTML scraper in Bun April 17, 2026 macOS
xbar-my-prs Info about your GitHub PRs in the macOS menu bar January 29, 2026 macOS
Set up iTerm to delete whole words on Option-Backspace May 13, 2025 macOS
Copy the current line in VS Code March 12, 2026 macOS
Related by keyword:
Introducing hylite - a Node code-syntax-to-HTML highlighter written in Bun October 3, 2023 Node, JavaScript, Bun
How I performance test PostgreSQL locally on macOS December 10, 2018 Web development, PostgreSQL, macOS
How to log ALL PostgreSQL SQL happening July 20, 2015 PostgreSQL, macOS
hastebinit - quickly paste snippets into hastebin.com October 11, 2012 Python, Linux