3

I cannot change the default setting back to Terminal for opening a session directly from Finder (from the path you can display at the bottom). I tried a few different ways to remove iterm2 completely but with no success. I believe that it is a known issue that is still unresolved, see this answer to how to uninstall iTerm2.

Does anyone know where exactly this default setting is stored, so I can just change it directly?

0

1 Answer 1

1

TL;DR

The file you are looking for is: ~/Library/Application\ Support/iTerm2

Move or remove it with

sudo mv -r ~/Library/Application\ Support/iTerm2 ~/Library/Application\ Support/old.iTerm2

or

sudo rm -r ~/Library/Application\ Support/iTerm2

respectively.


Long version

To fix the Finder context menu, in order to change the "Open with Terminal" back to the default, there seem to be two main options:

  • Rebuild Launch Services database
  • Delete the Application Support plist

Rebuild Launch Services database

One answer (or rather, workaround) seems to be to rebuild the Launch Services database.

This is mentioned/discussed in this post under the Gitlab issue Does not uninstall completely

The iTerm context menu items pictured -- along with MEGA, but I don't really care -- disappeared as soon as I attempted to rebuild Launch services using some copypasta scripting from here:

https://eclecticlight.co/2017/08/11/launch-services-database-problems-correcting-and-rebuilding/

I ran one of the script which ends with apps u, saw some of the same errors mentioned in the comments and then had to wait a few moments with an unresponsive Finder while stuff happened in the background.

So, following the link to Launch Services database problems: correcting and rebuilding, there are three (or four) options to rebuild the Launch Services database, in increasing order of "blast radius":

Option 1

Just the user domain - as suggested in the workaround posted under the Gitlab issue

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -v -apps u

Option 2

Three domains – system, local, and user

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -v -apps u,s,l

Option 3

The whole database

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -v -all u,s,l

Option 4

Older syntax (user domain only):

/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -v -domain u

Additional reference

Syntax
     lsregister: [Options] [path...]
                    [-apps domain[,domain]...]
                      [-libs domain[,domain]...]
                          [-all  domain[,domain]...]

lsregister is not on the system path so run it using the full path as shown in the examples below.

Options
  -delete   Delete the Launch Services database file. You must then reboot!
  -kill     Reset the Launch Services database before doing anything else.
  -seed     If database isn't seeded, scan default locations for applications and libraries to register.
  -lint     Print information about plist errors while registering bundles.
  -lazy n   Sleep for n seconds before registering/scanning.
  -r        Recursive directory scan, do not recurse into packages or invisible directories.
  -R        Recursive directory scan, descending into packages and invisible directories.
  -f        force-update registration even if mod date is unchanged.
  -u        unregister instead of register.
  -v        Display progress information.
  -gc       Garbage collect old data and compact the database.
  -dump [table]
            Display full database contents after registration.
  -h        Display help.
 
 
  -convert  Register apps found in older LS database files

Delete the Application Support plist

From this answer (and looking at what AppCleaner also recommends in this answer) to How to uninstall iTerm2, and judging by this comment, if the iTerm2 application bundle has already been removed, but the Finder context menus still remain, then this command alone should remove them:

sudo rm -r ~/Library/Application\ Support/iTerm2

Failing that, to manually delete all the context menus and application bundle, then the three commands required are:

sudo rm ~/Library/Preferences/com.googlecode.iterm2.plist
sudo rm -r ~/Library/Application\ Support/iTerm2
sudo rm -r /Applications/iTerm.app 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .