Admin LaunchServices

launchctl 基本


/bin/echo "$ITEM_UTI"
if [ -f "$STR_FILE_PATH" ]; then
 /bin/launchctl stop -w "$STR_FILE_PATH"
 /bin/launchctl unload -w "$STR_FILE_PATH"
 /bin/launchctl disable -w "$STR_FILE_PATH"
 /bin/launchctl bootout -w "$STR_FILE_PATH"
 /bin/launchctl kill -w "$STR_FILE_PATH"
 /bin/rm "$STR_FILE_PATH"

/bin/echo "$ITEM_UTI"
if [ -f "$STR_FILE_PATH" ]; then
 /bin/launchctl start -w "$STR_FILE_PATH"
 /bin/launchctl load -w "$STR_FILE_PATH"
 /bin/launchctl enable -w "$STR_FILE_PATH"
 /bin/launchctl bootstrap -w "$STR_FILE_PATH"
 /bin/launchctl kickstart -w "$STR_FILE_PATH"
 /bin/rm "$STR_FILE_PATH"





$HOME/Library/Preferences/ にあります

lsregister: [OPTIONS] [ <path>... ]

                      [ -apps <domain>[,domain]... ]

                      [ -libs <domain>[,domain]... ]

                      [ -all  <domain>[,domain]... ]

Paths are searched for applications to register with the Launch Service database.

Valid domains are "system", "local", "network" and "user". Domains can also

be specified using only the first letter.

  -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 this help





sh-3.2$ /usr/bin/sqlite3 $HOME/Library/Preferences/

SQLite version 3.37.0 2021-12-09 01:34:53

Enter ".help" for usage hints.



sqlite> .tables


sqlite> .mode column

sqlite> select * from LSQuarantineEvent;

LSQuarantineEventIdentifier           LSQuarantineTimeStamp  LSQuarantineAgentBundleIdentifier  LSQuarantineAgentName  LSQuarantineDataURLString    




mkdir -pm 700 $HOME/bin

ln -s /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister $HOME/bin/lsregister

$HOME/bin/lsregister -lint com.tinyspeck.slackmacgap

$HOME/bin/lsregister -delete -r -domain user

$HOME/bin/lsregister -delete -r -domain local

$HOME/bin/lsregister -delete -r -domain network

$HOME/bin/lsregister -delete -r -domain system

$HOME/bin/lsregister -kill -r -domain user

$HOME/bin/lsregister -kill -r -v -f -domain user

$HOME/bin/lsregister -kill -r -domain local

$HOME/bin/lsregister -kill -r -domain network

$HOME/bin/lsregister -kill -r -domain system

$HOME/bin/lsregister -seed  -r -v -f -domain user

$HOME/bin/lsregister -seed -r -domain local

$HOME/bin/lsregister -seed -r -domain network

$HOME/bin/lsregister -seed -r -domain system

$HOME/bin/lsregister -lint  -r -v -f -domain -apps  user

$HOME/bin/lsregister -lint -r -domain  -all local

$HOME/bin/lsregister -lint -r -domain  -all network

$HOME/bin/lsregister -lint -r -domain -all system

$HOME/bin/lsregister -seed  -r -v -f -domain  -apps user

$HOME/bin/lsregister -seed  -r -v -f -domain  -libs user

$HOME/bin/lsregister -seed  -r -v -f -domain  -all user

$HOME/bin/lsregister -dump  -r -v -f -domain  -apps user | grep uti:  

$HOME/bin/lsregister -dump  -r -v -f -domain  -apps user | grep "type id:"  

$HOME/bin/lsregister -dump  -r -v -f -domain  -apps user | grep "claim id:"  




set aliasAppPath to (path to application id "com.tinyspeck.slackmacgap")
log aliasAppPath
set strAppPath to POSIX path of (path to application id "com.tinyspeck.slackmacgap")
log strAppPath

tell application "Finder"
return POSIX path of (application file id "com.tinyspeck.slackmacgap" as text)
end tell

set strAppName to ""

set strIsregisterPath to "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister" as text

set strResponse to (do shell script strIsregisterPath & " -dump | grep --only-matching \"/.*\\" & strAppName & "\"")


tell application "Finder" to set appNames to name of application files in entire contents of (path to applications folder)

tell application "Finder" to set appNames to name of application files in entire contents of (path to home folder)


set strApplicationFolderPath to (path to applications folder from local domain) as text
set strTextEditPath to strApplicationFolderPath & "" as text

my posixPathTo:""

on posixPathTo:appName
set bundleID to id of application appName
tell application "Finder" to return POSIX path of (application file id bundleID as alias)
end posixPathTo:

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

set ocidWorkSpace to current application's NSWorkspace's sharedWorkspace()

set ocidAppPath to ocidWorkSpace's URLForApplicationWithBundleIdentifier:"com.tinyspeck.slackmacgap"

set strAppFilePath to ocidAppPath's absoluteString() as text
log "strAppFilePath: " & strAppFilePath

set aliasAppPath to ocidAppPath as alias
log "aliasAppPath: " & aliasAppPath

set strAppPath to ocidAppPath's |path|() as text
log "strAppPath: " & strAppPath



Acrobat Acrobat Annotation Acrobat Dialog Acrobat Form Acrobat JS Acrobat Open Acrobat Plugin Acrobat python Acrobat Reader Acrobat Sequ Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Apple AppleScript AppleScript Guide AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript Plist System Events AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript YouTube AppleScript Zero Suppress Applications Barcode OnLine Tools CityCode Design iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom