TextMate News

Anything vaguely related to TextMate and macOS.

InputManagers on Leopard

Contrary to most rumors, input managers still work on Leopard (at least on my pre-GM seed), but for an input manager to be loaded there are now a few requirements it needs to fulfill.

This is taken from the ApplicationKit release notes:

  1. The valid installation is now restricted to the /Library/InputManagers folder only. Bundles in other locations are silently ignored.

  2. All the files in the bundle and /Library/InputManagers folder itself must be owned by the root user and admin group. No files inside the bundle can have group or other write permissions.

  3. Processes running with the root privilege (getuid() == 0 or geteuid() == 0) cannot load any bundle input manager.

  4. Processes running with the wheel group privilege cannot load any bundle input manager.

  5. The process must be in the active workspace session at the time of loading the bundles.

  6. The process must not be tainted by changing user or group id (checked by issetugid()).

  7. No 64-bit processes can load any bundle input managers.

First item says that other locations are silently ignored, this however has not been my experience. I had to remove ~/Library/InputManagers before I got mine working (presumably I could have settled with removing the contents of that folder).

So if you want Edit in TextMate to work on Leopard, here is what to run from Terminal (assuming TextMate.app is in /Applications):

# Remove old version
rm ~/Library/InputManagers/Edit\ in\ TextMate

# Create InputManagers folder
sudo mkdir /Library/InputManagers

# Copy the input manager to /Library
sudo cp -pR /Applications/TextMate.app/Contents/Resources/Edit\ in\ TextMate /Library/InputManagers

# Ensure everything is owned by root
sudo chown -R root:admin /Library/InputManagers

A downside with this (apart from the hassle) is that this is deep-copying the input manager, so when it gets updated, you need to make a new full copy to /Library/InputManagers to get the improvements.

Also, Apple writes in the same release notes that:

The automatic loading of bundles located in InputManagers folders is now officially unsupported […] This functionality is likely to be disabled in a future release.

So for how long they will stay around is unknown.

categories General

56 Comments

when release textmate2 for leopard? and navtive cjk inputs?

No 64-bit processes can load any bundle input managers.

Does this mean InputManagers don’t work at all in 64-bit Leopard?

[…] still work, but in a different way. I’m worried that they’ll be gone in the future, though. See this. __________________ Guy in the […]

26 October 2007

by Jacob Rus

Jay: ask him again in several months. :)

I could not wait several months. please release it soon! :)

Wim, it means 64-bit cocoa applications cannot be hooked. It can hook legacy applications, 32-bit compiled cocoa apps, and some system components, but if it’s 64-bit it won’t work with it. Sound like they’ve actually made code signing and sandboxing work in 10.5. I wouldn’t know, I won’t have it for a few days. TextMate 2.0 will come out eventually

Allan could not test TextMate for the GA of Leopard because Apple wouldn’t even let the developers get the final version, they had to wait until last night. I’m sure Allan’s been doing work on his seed though.

Allan, are you still making TextMate 2.0 free for existing users who migrate to Leopard?

27 October 2007

by Erik van Eykelen

If TextMate 2.0 is really going to be free for existing users, why don’t we (existing users) raise money for a charity to be picked by Allan?

I use TM professionally day in day out, I would gladly pay $100 for an upgrade. @Allen: I’m the first contributor!

27 October 2007

by Nigel Metheringham

I also had to remove the ~/Library/InputManagers directory before this method worked (on a DVD copy of Leopard).

27 October 2007

by Jozef Remen

I can’t get it to work. Inquisitor and SafariSource works fine but Edit in TextMate does not, it’s not even visible in Edit menu of any app. Tried to logout, changed permissions, nothing helps. As I have said, other Input Managers are working well.

You rock. This made my Inquisitor work again, properly.

I found that while PimpKit worked, it was a bit of a hack requiring a certain MIME type to be needed on a page before it’d work. PlugSuit loaded inquisitor partially (?) so it couldn’t be configured.

Regular inputmanager loader: flawless. Thanks.

[…] are deprecated in Leopard and may be removed in future releases. There’s a blog post here with a potential workaround, but I haven’t tried it myself. I may try Privoxy to see if it […]

Thanks for the explanation James!

[…] wenn der Entwickler schon fleißig an der Leo-kompatiblen Version arbeitet) setzen auf die angeblich nicht mehr vorhandene Möglichkeit Input Manager zu nutzen und versagen standardmäßig Ihren Dienst. Hier gibt es aber mit PlugSuit bereits eine […]

[…] el creador de Inquisitor, acaba de postear en su blog algo que nos alegra a muchos: Finalmente Apple no nos ha capado tanto como pensábamos y al menos Inquisitor funciona perfectamente en la versión final de Leopard, eso sí, sólo en su […]

[…] 3 but it has not blocked any ads yet eventhough it’s enabled. I followed the instructions here: TextMate Blog

[…] dann – in den Einstellungen taucht Saft aber auf). InputManagers sollen weiterhin mit dieser Information laufen, Saft habe ich damit aber noch nicht wieder reaktivieren […]

[…] bestimmten Voraussetzungen doch unter Mac OS X 10.5 Leopard laufen. Die genauen Vorgaben werden ein TextMate Blog beschrieben. Muss ich dann mit dem GM von 10.5 mal […]

[…] die über Input Manager verwendet wurden, erhöht wurde. Die genauen Bedingungen lassen sich im TextMate Blog nachlesen. Deswegen gibt es seit heute das kostenlose Pflichtool Inquisitor, dass Safari um eine […]

Why not just use a symlink in /Library/InputManagers instead of the deep copy? That neatly avoids the manual update problem:

sudo ln -s /Applications/TextMate.app/Contents/Resources/Edit\ in\ TextMate /Library/InputManagers/Edit\ in\ TextMate

I have the official Leopard release installed. The workaround using doesn’t seem to work for me. Maybe they changed something between pre-GM and the shrink-wrap version.

I can understand if this was a security issue - hopefully Apple didn’t just do it to be mean :-)

Not working here either. Running the retail version of Leopard. Any suggestions?

[…] Input managers are bundles that are loaded into all running programs. Originally intended for the mundane tasks of internationalization and accessibility, they’ve mutated into a generic plugin facility for all Cocoa programs. If you’re using things like SIMBL, Saft, SafariStand, Sogudi, or Pith Helmet, you’re abusing input managers. Leopard “breaks” them. […]

I am now on GM and input managers still work for me.

If you have a problem try:

# remove all local input managers
rm -rf ~/Library/InputManagers

# set permissions properly on system wide input managers
sudo chmod -R go-w /Library/InputManagers
sudo chown -R root:admin /Library/InputManagers

Notice I also do a chmod here. I didn’t do that in my blog post, since I figured the default permission flags should be fine, but maybe this is your problem.

John: The symbolic link will require a sudo chown after each upgrade of TextMate, so it’s not an ideal solution.

Erik/James: Yes, 2.0 remains a free upgrade, whenever it comes out (Jay: there is no ETA, let me promise that when I have an ETA, I will announce it wide and broad, so in the meantime there is no need to ask about it ;) ).

Thanks Allan for the Update.

You are my greatest hero ;)

Allan, that did the trick for me too. Thanks much everyone.

Now if only I could figure out the 2-3 other programs that Leopard funked up.

30 October 2007

by douglas adams

“The automatic loading of bundles located in InputManagers folders is now officially unsupported […] This functionality is likely to be disabled in a future release.”

So what is the replacement going to be?

Dumb question time: What is a “workspace session”? Does that mean all processes parented by an individual login? And to be active means that the user is the one currently switched in at a gui?

[…] of them all together. (UPDATE: Oops, I guess they are still loaded in Leopard, but with a bunch of added restrictions. Also, there is a release not saying they are not supported, and might not be loaded in the […]

Reading through this security overview: http://www.matasano.com/log/981/a-roundup-of-leopard-security-features/ I to ask, is it wise to use the Input Manager? “Input managers are terrifying. They’re arbitrary blobs of code that get injected into almost every Mac application. They are a “UI extension interface” in the same way that Back Orifice 2k is a “remote system administration facility”.”

Mikael: If you like the functionality they provide, sure, you should run them.

TextMate itself is also an arbitrary blob of code that gets run (presumably almost every time you turn on your mac) and it has (write) access to your entire home folder ;)

The difference is only that TextMate is confined to a single process so if the code is bad (in a non-malicious way) it likely will only take down that single process.

Something like Edit in TextMate though gets loaded into all Cocoa applications, so if the code is bad (i.e. causing crashes) then it can possibly affect all your Cocoa applications. But the same can be said about all the system frameworks, is not related to security (but rather stability), and if you didn’t get any crashes from installing it, is a hypothetical argument.

The security argument is more along the lines of, Acme Inc. ships AppExtreme and digitally signs it. You trust Acme Inc. and allows AppExtreme to access your credit card number (stored in the KeyChain). The operating system uses the digital signature of AppExtreme to verify that it really is from the same vendor as the one you initially said you trusted.

Later you get NastyApp from Vertigo Corp., you want to run it, you trust it enough to run it (and have it potentially harm your entire file system) but you do not trust it enough to allow it to read your credit card number (from the KeyChain).

Now in the past, NastyApp would be able to install an input manager when launched, and the next time you run AppExtreme, NastyApp’s code will run, and it can then access your credit card number since the system believes the code falls under what was signed by Acme Inc.

So to summarize, the security concern as I see it was that one vendor could exploit the trust given to another vendor, by installing an input manager behind your back.

For definitions of “vendor” that include “authors of malware”, yeah, I think you’re on the money there, Allan. :)

[…] completely removed from Leopard. But thankfully as Allan Odgaard of Macromates points out in his blog, that’s not (quite) the […]

[…] guida è tratta da Textmate Aggiungi a del.icio.us 2 Views ZN utilizza WordPress Revolution v4.1 basato su iTheme di […]

[…] steht mit der neuen Version von SafariStand bereit. Eine Ausführliche Beschreibung kann im TextMate-Forum nachgelesen werden. Gequakt von TheMaverick Abgelaicht in Apple, Tutorials, Web, […]

Thanks for the heads up! I went into some more detail about Input Managers on Leopard on our blog here: http://macdaddyworld.com/ -Ken

[…] Whether that’s down to changes to how Input Managers are handled in Leopard or something else I don’t know. (Input Managers aren’t, as earlier thought, totally banished in Leopard, they just operate under tighter restrictions.) […]

[…] In Leopard, InputManagers need to be installed in /Library and owned by root, for security reasons. Tutorials how to re-enable them can be found e.g. on Mac OS X hints or in the TextMate blog. […]

[…] Leopard update:Still using Safari 3, only it’s not in beta anymore. InputManagers are still working, albeit in a more secure way. […]

[…] of Chax from ~/Library/InputManagers. Anyone still experiencing trouble should take a look at Allan Odgaard’s write-up on setting permissions correctly so that Input Managers will […]

[…] TextMate Blog » InputManagers on Leopard (tags: osx software leopard textmate) […]

Apparently, no file inside the bundle can be executable either. This causes many input managers to fail despite of every precaution taken above since, very often, the file inside Whatever.bundle/Contents/MacOS/ is executable. Changing this requires more than a chmod -x since directories need to be “executable”. So find comes to the rescue find . -perm u=rwx,go=rx -type f to find those offending files, if any. And sudo find . -perm u=rwx,go=rx -type f -exec chmod -x {} \; to change their permissions.

Maybe this deserves an edit of point number 2 in the checklist.

[…] # Remove old version rm ~/Library/InputManagers/Edit in TextMate # Create InputManagers folder sudo mkdir /Library/InputManagers # Copy the input manager to /Library sudo cp -pR /Applications/TextMate.app/Contents/Resources/Edit in TextMate /Library/InputManagers # Ensure everything is owned by root sudo chown -R root:admin /Library/InputManagers[Via: TextMate Blog] […]

[…] Because I am so used to Textmate now, with all it’s navigation niceness and snippets and such, I don’t like to use any other apps to create more than a couple of lines of text. Textmate provides an input manager called ‘edit in textmate’ that allows you to work on text from any cocoa application right in Textmate. If I’m writing an email that goes longer than a few lines I can hit ctrl-cmd-e and open the text in Textmate. Once I’m done I just save the file and close it and I am taken back to Mail with the text all ready to go in my message. There is a command in the Textmate bundle to install this but you need to do something slightly different to install in Leopard - see here for Leopard install instructions. […]

[…] be sure to follow these instructions if you are on […]

[…] on OS X. I had problems getting it to work on leopard until I discovered some Leopard-specific issues with input managers. What I ended up doing […]

[…] The “Edit in TextMate” feature (part of the TextMate TextMate bundle) lets you call upon TextMate to edit text fields in other applications. However, following the instructions in the TextMate bundle was not working. It turns out this is due to a change in how Leopard handles Input Managers. Here are the steps you need to take to enable the “Edit in TextMate” feature in Leopard. […]

[…] URL requests and provide data if necessary. The problem is that Apple has limited the use of Input Manager in Leopard by imposing more restrictive rules as a security measure, one of which is processes running with […]

[…] the way I blog. Footnotes:I used to do this seamlessly using Library Input Managers such as the bundle developed by TextMate. But since Leopard these are unofficially unsupported by Apple, apparently […]

Just had to install TextMate from scratch on the new MBP on 1.5.8 and cannot get it work, the Edit in TextMate extension. I had it working on the old MBP with the same version of OS X. The “Edit in TextMate” appears in the Edit menu of Cocoa apps but once you activate either with key shortcut or directly from menu nothing happens.

Tried all the mentioned methods from the post and comments, no luck. Other InputManagers like SafariStand, SafariBlock, Chax, Glims and 1password work all correctly.

Any ideas? thanks in advance

Stan: No idea what goes wrong, but I have heard about it a couple of times before.

I can only suggest the normal troubleshooting measures, like testing if this is a local problem (by creating a new account), resetting launch services database (as it might be, that the input manager can’t reach TextMate), and whatever else you can think of.

Ideally someone with C/Objective-C skills would insert some debug output into the input manager (which I released as F/OSS).

Thanks Allan. Might be out my usual scope of understanding But I will a try and use more google to find a solution. Thanks again.

07 October 2009

by Uğur Özyılmazel

hi!, well, “edit in TextMate” is not working… Any chance to fix this? i know , many people has some issues with that… i tried lotsa stuff and still now working…

07 October 2009

by Uğur Özyılmazel

well, i used latest build of “Edit in TextMate” and it worked… Thanx Allan!