System/library/frameworks Mac

Author
  1. Mac /system/library/frameworks/python.framework/versions/2.7
  2. /system/library/frameworks/security.framework/versions/a/machservices/security Agent.bundle
  3. System/library/frameworks Mac And Cheese
  4. /system/library/frameworks/cryptotokenkit.framework/ctkahp.bundle/contents/macos/ctkahp

Bob Savage <bobsavage@mac.com>

Python on a Macintosh running Mac OS X is in principle very similar to Python onany other Unix platform, but there are a number of additional features such asthe IDE and the Package Manager that are worth pointing out.

Try and document all OSX 10.10 LaunchDaemons and LaunchAgents. Jan 09, 2012  The lsregister command is used to query and manage the Launch Services database, or the database that is used to determine the default application used to open files of various types. Lsregister is part of Core Services, and stored in /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support.

4.1. Getting and Installing MacPython¶

Mac OS X 10.8 comes with Python 2.7 pre-installed by Apple. If you wish, youare invited to install the most recent version of Python 3 from the Pythonwebsite (https://www.python.org). A current “universal binary” build of Python,which runs natively on the Mac’s new Intel and legacy PPC CPU’s, is availablethere.

Using Python on a Macintosh¶ Author. Bob Savage mac. Com Python on a Macintosh running Mac OS X is in principle very similar to Python on any other Unix platform, but there are a number of additional features such as the IDE and the Package Manager that are worth pointing out. Sep 16, 2015 OS X Frameworks. The OS X frameworks provide the interfaces you need to write software for Mac. Some of these frameworks contain simple sets of interfaces while others contain multiple subframeworks. Where applicable, the tables in this appendix list the key prefixes used by the classes, methods, functions, types, or constants of the framework. Mar 06, 2011 MacRumors attracts a broad audience of both consumers and professionals interested in the latest technologies and products. We also boast an active community focused on purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms. 125 rows  Sep 16, 2015  The OS X frameworks provide the interfaces you need to write software for Mac. Some of these frameworks contain simple sets of interfaces while others contain multiple subframeworks. Where applicable, the tables in this appendix list the key prefixes used by the classes, methods, functions, types, or constants of the framework. CommCenter is the service handling network connectivity on the iPhone, iPad and iPod touch. Disabling CommCenter (launchctl unload -w /System/library/LaunchDaemons.

What you get after installing is a number of things:

  • A Python3.8 folder in your Applications folder. In hereyou find IDLE, the development environment that is a standard part of officialPython distributions; PythonLauncher, which handles double-clicking Pythonscripts from the Finder; and the “Build Applet” tool, which allows you topackage Python scripts as standalone applications on your system.

  • A framework /Library/Frameworks/Python.framework, which includes thePython executable and libraries. The installer adds this location to your shellpath. To uninstall MacPython, you can simply remove these three things. Asymlink to the Python executable is placed in /usr/local/bin/.

The Apple-provided build of Python is installed in/System/Library/Frameworks/Python.framework and /usr/bin/python,respectively. You should never modify or delete these, as they areApple-controlled and are used by Apple- or third-party software. Remember thatif you choose to install a newer Python version from python.org, you will havetwo different but functional Python installations on your computer, so it willbe important that your paths and usages are consistent with what you want to do.

IDLE includes a help menu that allows you to access Python documentation. If youare completely new to Python you should start reading the tutorial introductionin that document.

If you are familiar with Python on other Unix platforms you should read thesection on running Python scripts from the Unix shell.

4.1.1. How to run a Python script¶

Your best way to get started with Python on Mac OS X is through the IDLEintegrated development environment, see section The IDE and use the Help menuwhen the IDE is running.

If you want to run Python scripts from the Terminal window command line or fromthe Finder you first need an editor to create your script. Mac OS X comes with anumber of standard Unix command line editors, vim andemacs among them. If you want a more Mac-like editor,BBEdit or TextWrangler from Bare Bones Software (seehttp://www.barebones.com/products/bbedit/index.html) are good choices, as isTextMate (see https://macromates.com/). Other editors includeGvim (http://macvim-dev.github.io/macvim/) and Aquamacs(http://aquamacs.org/).

To run your script from the Terminal window you must make sure that/usr/local/bin is in your shell search path.

To run your script from the Finder you have two options:

  • Drag it to PythonLauncher

  • Select PythonLauncher as the default application to open yourscript (or any .py script) through the finder Info window and double-click it.PythonLauncher has various preferences to control how your script islaunched. Option-dragging allows you to change these for one invocation, or useits Preferences menu to change things globally.

4.1.2. Running scripts with a GUI¶

Mac

With older versions of Python, there is one Mac OS X quirk that you need to beaware of: programs that talk to the Aqua window manager (in other words,anything that has a GUI) need to be run in a special way. Use pythonwinstead of python to start such scripts.

With Python 3.8, you can use either python or pythonw.

4.1.3. Configuration¶

Python on OS X honors all standard Unix environment variables such asPYTHONPATH, but setting these variables for programs started from theFinder is non-standard as the Finder does not read your .profile or.cshrc at startup. You need to create a file~/.MacOSX/environment.plist. See Apple’s Technical Document QA1067 fordetails.

For more information on installation Python packages in MacPython, see sectionInstalling Additional Python Packages.

4.2. The IDE¶

MacPython ships with the standard IDLE development environment. A goodintroduction to using IDLE can be found athttp://www.hashcollision.org/hkn/python/idle_intro/index.html.

4.3. Installing Additional Python Packages¶

There are several methods to install additional Python packages:

  • Packages can be installed via the standard Python distutils mode (pythonsetup.pyinstall).

  • Many packages can also be installed via the setuptools extensionor pip wrapper, see https://pip.pypa.io/.

4.4. GUI Programming on the Mac¶

There are several options for building GUI applications on the Mac with Python.

PyObjC is a Python binding to Apple’s Objective-C/Cocoa framework, which isthe foundation of most modern Mac development. Information on PyObjC isavailable from https://pypi.org/project/pyobjc/.

The standard Python GUI toolkit is tkinter, based on the cross-platformTk toolkit (https://www.tcl.tk). An Aqua-native version of Tk is bundled with OSX by Apple, and the latest version can be downloaded and installed fromhttps://www.activestate.com; it can also be built from source.

wxPython is another popular cross-platform GUI toolkit that runs natively onMac OS X. Packages and documentation are available from https://www.wxpython.org.

PyQt is another popular cross-platform GUI toolkit that runs natively on MacOS X. More information can be found athttps://riverbankcomputing.com/software/pyqt/intro.

4.5. Distributing Python Applications on the Mac¶

The “Build Applet” tool that is placed in the MacPython 3.6 folder is fine forpackaging small Python scripts on your own machine to run as a standard Macapplication. This tool, however, is not robust enough to distribute Pythonapplications to other users.

The standard tool for deploying standalone Python applications on the Mac ispy2app. More information on installing and using py2app can be foundat http://undefined.org/python/#py2app.

4.6. Other Resources¶

The MacPython mailing list is an excellent support resource for Python users anddevelopers on the Mac:

Another useful resource is the MacPython wiki:


How to rebuild the LaunchServices database 38 comments Create New Account
Click here to return to the 'How to rebuild the LaunchServices database' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.

I can't see it, but a '?' pops into the command when I paste it into Terminal. If anyone else has the same problem, you could try pasting into a text editor, deleting the backslashes and excess spaces, and then copying and pasting the result into Terminal. It worked for me!
Apart from that, I'm really grateful for this hint - I'm the kind who gets really irritated by three copies of GraphicConverter in the Open With list!
Many thanks - Nick

When I type 'lsregister' in Terminal (bash or tcsh shell), I get 'command not found' in 10.3.2. Anyone else?

Would that not be because the directory where it is to be found is not in your search path? That must be why the hint includes the complete path to it.
Nick

When I used the lsregister command as given in the hint, with the full path, it did not work. I had to do 'locate lsregister' to find the complete path for my system, which included two 'Versions/A' folders in the folder tree.
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister
Whatever the path is for your system, 'locate' should find it for you.
---
Microsoft MVP for Entourage
AppleScripts for OE and Entourage

If you use this hint and have applications located someplace other than /Applications you need to append the path to the end of the command. The first time I ran it without any paths and my LaunchServices database included only applications on the boot volume.
---
Mike Newman
Saipan and Narita Layover Pages:
http://net.saipan.com/personal/mike_newman/

I had a strange problem in Tiger that when I clicked on a folder in the dock or dragthing it would launch iPhoto or Entourage. Running this command fixed everything.
---
-Mr. Unknown-

I tried a couple of hints here. This is the one that finally worked for me. I added -f, and I also appended the path to my personal applications folder (within the applications folder) at the end:
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -f -domain local -domain system -domain user '/Applications/MyApps'

I tried this hint and it worked by removing duplicate items in my Open With contextual menu. But now, it seems the icons on certain file types are wrong even though double clicking on them opens them up in the correct application.
Has anyone seen this too and/or know how to fix it? ;-)

My mp3 files had strange icons.
A reboot fixed me right up.

When I have strange icons, at times, quiting Finder usually takes care of that..

I'm still running 10.2.8, plan to install Panther this next week. Neither the path nor the command (-kill) worked for me as is. I found the app at ..LaunchServices.framework/Versions/A/Support/lsregister. Upon invoking the hint's command line using my path, I got the 'usage' spiel: different from that listed by the hint's author, mine does not include -kill, -lint, -f or -dump.
When I tried the command with my path and leaving out the -kill switch, it seemed to work. As I've not been having any trouble with 'Open with' and allies, I saw no result. A little anti-climactic, but filed away for future reference. Thanks very much!
btw, who (or what) is CF that we should ask about the domains' applications locations?
Ganymede

CF must refer to CoreFoundation.

Thank you for this tip! Ever since I upgraded to Panther I get a lot of double entries in the Open with.. context menu, seems to be gone now.

I tried this hint and it appears to have cleaned up my 'Open with' context menu. But a strange thing happened afterward that may or may not have been related. I have an external FireWire drive mounted. As some of you know, this shows up on your desktop even when your Finder preferences are set to not display dirves in 10.3. You can remove it from the desktop by also not displaying CDs, DVDs and iPods, which I chose not to do- I lived with it on my desktop even though I don't want it there.
But immediately after using this hint, my drive disappeared from my desktop. It's still visible in the left-hand portion of my Finder windows and I can access it from there (which I much prefer). But no matter what Finder preferences I set, it never shows up on my desktop. I've rebooted twice and it still won't show up.
Not a bad thing in my case, but a little alarming nontheless. Has anyone else experienced this behavior after using this hint?

If you tried this with the most recent security update installed
http://docs.info.apple.com/article.html?artnum=61798
You'll be asked many times when you try to open some documents the first time. Type 'lsregister -dump less' will show you that all entries for third-party applications now have the form like this:
B00001546 APPL/CHIM Tue Jun 8 15:16:55 2004 Camino.app
-pad----hn---sr-----! v0.8.0 Camino
Contents/Resources/appicon.icns org.mozilla.navigator
Contents/MacOS/Camino 6263372, 6263906, Mach-O
V00000008 /Applications/Internet/Camino.app
Note the ending '!' - that means it's never been run before.
I wonder if there's a way to reset all of these '!' using some tool.

I'm running 10.3.5, which includes those security updates, and this hint worked great for me.
I used the System Migration tool on a new Powerbook to pull the account information from an old one, and the only (knock wood) problem was that the Open With.. menu was bloated with double entries for everything. This hint solved the problem quickly and easily.

In case anyone runs into the error message application [application name] cannot be launched because it may be damagaed or incomplete, rebuilding the LaunchServices database using the command from this hint may fix it.

I had no luck until I added the -f (force-update registration info even if mod date is unchanged) switch to the command line like so..
System/Library/Frameworks/ApplicationServices.framework/
Frameworks/LaunchServices.framework/Support/lsregister
-kill -r -f -domain local -domain system -domain user
Fixed me right up!

I have tried every iteration of the command listed here, but I still have 4 instances of Adobe Acrobat 6.0.3 listed in my 'Open With' menu.
When I add -v to the command, it shows me a long list of errors:
'error 10811 registering <filename> '
Any ideas why?
Ethan

Hope I can keep this thread going a bit longer.. I tried the command given (adding the -f): I got a 'no such file or directory' result. Following the path, I found that the Support folder was an alias. Using the pathname to the original worked like a charm: Have wanted to fix this for who knows how long. Thanks a lot! Just a tidbit: if you still have multiple copies of Opera in this menu, as I did, check your Studio MX 2004 Flash and Contribute directories if you have them.

Alright! That one did the trick!

This worked for me:
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -f -domain local -domain system -domain user '/Applications'
Just wish there was a way to manually edit the applications in the list as there are many listed that I never use!

I can confirm this worked for me on 10.4.9.

I had applications that were opening Script Editor instead of the desired application. (i.e. double-clicking InDesign 2.0.1 would open Script Editor instead of InDesign)
Applying the command in this hint seems to have resolved that issue.
Thanks!

Jan 12, 2020  Make the Library Visible Permanently. Apple hides the Library folder by setting a file system flag associated with the folder. Any folder on your Mac can have its visibility flag turned on or off; Apple just chose to set the Library folder's visibility flag to the off state. To reset the visibility flag, do the following: Launch Terminal. Follow the steps below to access the Hidden Library Menu option on your Mac. Left-click your mouse anywhere on the screen of your Mac. This will reveal the Go Option in the top menu bar of your Mac. You can also click on the Finder Icon in the Dock of your Mac to activate the Go Option. May 30, 2019  By default, the Library folder on Mac is hidden from the user. Apple keeps Library invisible in order to protect users from accidental deletion or modification of important files stored there: application settings, caches and other system files needed to run the programs. Dec 12, 2016  If you don’t need to constantly show the /Library folder on the Mac, you can just access it when needed by using the “Go” menu: From the Finder of Mac OS, pull down the “Go” menu and hold down the SHIFT key Choose “Library” from the drop down list. See system library mac. ⌘-Shift-G is the hotkey for the 'Go to Folder' dropdown menu. Just type in /System/Library/Extensions and click Go to open that folder. I think your screenshot may be in your User folder, not the System folder. The System folder lives in Macintosh HD, not within a specific user's files.

I can confirm this works with 10.4.6, but by using 'locate lsregister' first.
Thanks!

Mac /system/library/frameworks/python.framework/versions/2.7

I see from the comments that many here are not familiar with Unix. Here's the way to run any command that is in your currrent directory.
[your_prompt]: ./CommandName
The trick is that many shells (tcsh, bash, etc) don't include the current working directory in their .cdpath list. '.' is shorthand for 'where I am right now,' so './command' will always work
Carl

/system/library/frameworks/python.framework

I'm confused by your comment. AFAICT, it implies that you don't need the path to lsregister. However, when I run this, it doesn't do what I inferred.
localhost:~ baltwo$ ./lsregister
-bash: ./lsregister: No such file or directory
Please clarify.

This is still a very useful hint - I just used it today. Thanks!
Wish Apple had a GUI or a cron that took care of this for us though..

and here's how to use this hint in Leopard, which has moved the location of the file.
Open a Terminal window and type in
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
This worked for me, but YMMV, so use at your own risk.

worked for me too on 10.5.1
---
~/.sig: not found

In Mac OS X 10.5.1 it seems the command line option have changed to: So I used: Seemed to work fine.

I couldn't get this command to run successfully from the command line even using sudo.
Happily enough TinkerTool System from Marcel Bresink includes a rebuild Launch Services feature User - > Launch Services which took care of the problem in 20 seconds. Finally I can right click jpegs again!
Thanks for the tip anyway.
---
WordPress SEO Secrets - foliovision.com/weblog

Here's an AppleScript that can be saved as a script and launched from the Script menu, or saved as an application and launched from anywhere.
(*
rebuildLaunchServicesDB.scpt
Locates the lsregister command regardless of OS version, then tells it to rebuild the Launch Services Database for all applications in the canonical Applications folder
Paul Henegan
bleulyon@mac.com
20.Aug.2008
*)
set theCommand to (do shell script 'locate lsregister')
set theArguments to ' -kill -r -f -domain local -domain system -domain user'
set thePath to ' /Applications'--edit this as needed
set theScript to theCommand & theArguments & thePath
do shell script theScript

This really sucks because it was a very easy way to play music in the den that is stored just 30 feet away in another room. I wish I'd never upgraded to the new iTunes as iTunes 11 worked perfectly. Rex shared library for mac free. Anyone have a solution for this issue? Running Yosemite on the Mac Mini and Mavericks on my Macbook.

appears to havecleaned up my 'Open with' context menu. But a strangething happened afterward that may or may not have been related. I have an external FireWire drive mounted. As some of you know, this shows up on your desktop even when your Finder preferences are set to not display dirves in 10.3. You can remove it from the desktop by also not displaying CDs, DVDs and iPods, which I chose not to do- I lived with it on my desktop
How to rebuild the LaunchServices database - the GUI-phile / shell-phobic way
This is a great tip and many, myself included, are perfectly comfortable mucking about in the shell.
But for those of you that get nervous at the mention of Terminal.app, there is a graphical alternative for this hint.
The popular utility Cocktail can rebuild the Launch Services database with a simple GUI click.
Happy DB rebuilding.
How to rebuild the LaunchServices database - the GUI-phile / shell-phobic way

/system/library/frameworks/security.framework/versions/a/machservices/security Agent.bundle

just in fairness, there are a number of 'service utility' apps that do this - Yasu and Onyx are two the spring to mind. or you can do what I did - write the code into an applescript and save it in the script menu. that way you only have to deal with the terminal command once.

Use Onxy rebuild launchservices to fix the problem

System/library/frameworks Mac And Cheese

10.6.4 here and I used Onxy maintenance > rebuild > launchservices. Fixed the problem. Onxy is a free program.

/system/library/frameworks/cryptotokenkit.framework/ctkahp.bundle/contents/macos/ctkahp

On 10.8 Mountain Lion: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user