Redigera egenskapslistor i Terminal på datorn
Inställnings- och konfigurationsfiler i macOS använder egenskapslistor (plist) till att ange attributen, eller egenskaperna, för en app eller process. Ett exempel är plisten för inställningar för Finder i mappen Library/Preferences/ i en användares hemmapp. Filen heter com.apple.finder.plist. Den förvalda namnkonventionen för en plist innefattar distributörens omvända DNS-namn tillagt före namnet på appen eller processen, följt av tillägget .plist.
Om du vill ändra egenskapslistor använder du kommandoradsverktyget defaults
. Kommandot defaults
är ett kraftfullt verktyg, och om du känner till den specifika nyckeln och värdet i en egenskapslista du vill ändra är verktyget defaults
mycket effektivt.
Verktyget defaults
fungerar direkt med delsystemet för macOS-inställningar och används av många appar i macOS till att hantera diverse inställningar. Det kan byggas in i kommandotolksskript och gör det möjligt att komma åt inställningar i de många domäner som finns på en dator.
Fastställ namnen på lämplig egenskapslista, nyckel och värden. Till exempel är namnet på egenskapslistan till Dock
com.apple.Dock.plist
. (Vid aktivering av kommandotdefaults
ska du utelämna tillägget .plist.)Ange värdena efter kommandot
defaults
:defaults write com.apple.dock orientation left
Starta vid behov om appen eller processen.
Detta kan göras på ett enkelt sätt genom att markera den berörda processen i Aktivitetskontroll och sedan klicka på Avsluta process. I det här exemplet skulle du välja processen med namnet Dock.
Du kan också ändra filer med egenskapslistor i Xcode som har en inbyggd redigerare för egenskapslistor. Om du vill använda Xcode dubbelklickar du på en .plist-fil i Finder.
Om Xcode inte är installerat på datorn hämtar du det från Mac App Store.