Apple - Show package contents from command line

You can simply cd into the package to open it in Terminal, then open Contents to open the contents in Finder.

For example, to open the contents of Safari.app in Finder, you can run the following:

cd /Applications/Safari.app
open Contents

Using open -R for the first file in the bundle would work even if the bundle doesn't have a Contents directory:

reveal() (
  shopt -s nullglob
  for f; do
    a=("$f"/*)
    [[ -d $f && ${#a} != 0 ]] && open -R -- "${a[0]}" || open -R -- "$f"
  done
)

It might be easier to just type open -R and the path of some file inside the bundle though. You can bind menu-complete in .inputrc to make it easier to insert the path of the first file.

Tags:

Terminal