Posted on 11-25-2022 04:58 AM
Hi.
Can anyone advise why scripts are failing to remove non crop apps?
I have recently added several policies to jamf pro to remove non corp apps.
Policies \ Scripts added for.
App Books Removal
App Chess Removal
App FaceTime Removal
App Garage Band Removal
App Home Removal
App iMovie Removal
App Migration Assistant Removal
App News Removal
App Photo Booth Removal
App Podcasts Removal
App Stocks Removal
App Time Machine Removal
App TV Removal
App Weather Removal copy
I followed another script I found on JAMF Nation : /bin/rm -rf /Applications/*.app ( where * is application name )
For example : /bin/rm -rf /Applications/Books.app
I also tried with system in the file path: /bin/rm -rf /System/Applications/Books.app
The scripts run on the macs but don't actually remove the app(s).
The log file below is for the script set to remove Books app. I have not added the whole log file due to this post not being able to exceed 20,000 characters.
Log is full of Operation not permitted.
Executing Policy App remove Books test 2 |
Running script App Books Removal... |
Script exit code: 1 |
Script result: rm: /System/Applications/Books.app/Contents/_CodeSignature/CodeResources: Operation not permitted rm: /System/Applications/Books.app/Contents/_CodeSignature: Operation not permitted rm: /System/Applications/Books.app/Contents/MacOS/Books: Operation not permitted rm: /System/Applications/Books.app/Contents/MacOS: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksNotificationContentExtension.appex/Contents/_CodeSignature/CodeResources: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksNotificationContentExtension.appex/Contents/_CodeSignature: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksNotificationContentExtension.appex/Contents/MacOS/BooksNotificationContentExtension: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksNotificationContentExtension.appex/Contents/MacOS: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksNotificationContentExtension.appex/Contents/Resources/de.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksNotificationContentExtension.appex/Contents/version.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksStorageExtension.appex/Contents/Resources/BKLibrary.momd/BKLibrary_iBooks_8.0.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksStorageExtension.appex/Contents/Resources/BKLibrary.momd/BKLibrary_iBooks_4.9.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksStorageExtension.appex/Contents/Resources/BKLibrary.momd/BKLibrary.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksStorageExtension.appex/Contents/Resources/BKLibrary.momd/BKLibrary_iBooks_1.0.1_GM.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksStorageExtension.appex/Contents/Resources/BKLibrary.momd: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksStorageExtension.appex/Contents/Resources/es.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksStorageExtension.appex/Contents/Resources/da.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BooksStorageExtension.appex/Contents/Resources/it.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BookEPUBWebProcessPlugin.bundle/Contents/Resources/ms.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/BookEPUBWebProcessPlugin.bundle/Contents/Resources/pl.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/AppKitUtilities.bundle/Contents/Resources/ja.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/iBooksCacheDelete.appex/Contents/_CodeSignature/CodeResources: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/iBooksCacheDelete.appex/Contents/_CodeSignature: Operation not permitted rm: /System/Applications/Books.app/Contents/PlugIns/iBooksCacheDelete.appex/Contents/MacOS/iBooksCacheDelete: Operation not permitted rm: : /System/Applications/Books.app/Contents/Frameworks/JSApp.framework/Versions/A/_CodeSignature/CodeResources: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/es_419.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/BCReadingStatistics.momd/BCReadingStatistics.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/BCReadingStatistics.momd/VersionInfo.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/BCReadingStatistics.momd: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/zh_CN.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/CRDTModelSync.momd/CRDTModelSync2.omo: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/CRDTModelSync.momd: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/it.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/IMAccessibility.loctable: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/sk.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/iB_Generic_Book-3x.png: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/AEAssetInfo.html.tmpl: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/BCReadingStatisticsSync.momd/VersionInfo.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/BCReadingStatisticsSync.momd/BCReadingStatisticsSync.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/BCReadingStatisticsSync.momd: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/version.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/hr.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/hi.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/ca.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/AEAssetShare.css: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/RecentlyOpenedBooksDB.momd/VersionInfo.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/RecentlyOpenedBooksDB.momd/BookReadingTimesDB.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources/RecentlyOpenedBooksDB.momd: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/Resources: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A/BookCore: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/A: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions/Current: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/Versions: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework/BookCore: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookCore.framework: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Resources: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A/_CodeSignature/CodeResources: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A/_CodeSignature: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A/Resources/BooksMessages.momd/VersionInfo.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A/Resources/BooksMessages.momd/BooksMessages.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A/Resources/BooksMessages.momd: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A/Resources/Info.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A/Resources/version.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A/Resources: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A/EngagementCollector: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/A: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/EngagementCollector.framework/Versions/Current: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/BSUIItemDescriptionCache.momd/BSUIItemDescriptionCache.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/BSUIItemDescriptionCache.momd/BSUIItemDescriptionCache2.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/BSUIItemDescriptionCache.momd/BSUIItemDescriptionCache2.omo: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/BSUIItemDescriptionCache.momd: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/sv.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/index.js: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/cs.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/ko.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/ic_ReadingStreak-number_210_v3.caar: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/no.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/product-feed.zip: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions/A/Resources/fr_CA.lproj: Operation not permitted rm: : /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework/Versions: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BookStoreUI.framework: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary.omo: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/VersionInfo.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary_iBooks_4.7.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary_iBooks_4.5.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary_iBooks_4.18.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary_iBooks_4.19.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary_iBooks_4.15.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary_iBooks_4.17.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary_iBooks_8.0.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary_iBooks_4.9.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd/BKLibrary_iBooks_1.0.1_GM.mom: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/BKLibrary.momd: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/BKLibrary.framework/Versions/A/Resources/es.lproj: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/TemplateUI.framework/TemplateUI: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks/TemplateUI.framework: Operation not permitted rm: /System/Applications/Books.app/Contents/Frameworks: Operation not permitted rm: /System/Applications/Books.app/Contents/Info.plist: Operation not permitted rm: /System/Applications/Books.app/Contents/PkgInfo: Operation not permitted rm: /System/Applications/Books.app/Contents/version.plist: Operation not permitted rm: /System/Applications/Books.app/Contents: Operation not permitted rm: /System/Applications/Books.app: Operation not permitted |
Error running script: return code was 1. |
11-28-2022 11:29 AM - edited 11-28-2022 11:30 AM
You're running into applications that are part of the OS (e.g. FaceTime, Books) and are protected by SIP, which blocks their modification/removal. Additional apps (e.g. GarageBand, Pages) are not part of the OS and therefore can be removed. The most you'll be able to do is restrict/block the OS-included apps with a profile or restricted software setting to prevent the app from being launched.
Posted on 12-09-2022 01:05 AM
I used the Restricted Software approach you suggested and it worked great.