Created
July 20, 2019 01:53
-
-
Save chris1111/30b9123a6d06864c0fe34666a107f72b to your computer and use it in GitHub Desktop.
Enable or Disable the Trim in macOS Catalina 10.15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Simple script by chris1111 | |
# Vars | |
apptitle="Trim Enabler Catalina" | |
version="1.0" | |
# Set Icon directory and file | |
iconfile="/System/Library/CoreServices/Expansion Slot Utility.app/Contents/Resources/AppIcon.icns" | |
# Select Trim Choice | |
response=$(osascript -e 'tell app "System Events" to display dialog "Enable or Disable the Trim in macOS Catalina\n\nCancel for Exit" buttons {"Enable","Disable","Cancel"} default button 1 with title "'"$apptitle"' '"$version"'" with icon POSIX file "'"$iconfile"'" ') | |
action=$(echo $response | cut -d ':' -f2) | |
# Action is user select Disable | |
if [ "$action" == "Disable" ] ; then | |
response=$(osascript -e 'tell app "System Events" to display dialog "Your Choice is Disable Trim Enabler Catalina\n\n" buttons {"Cancel","OK"} default button 2 with title "'"$apptitle"' '"$version"'" with icon POSIX file "'"$iconfile"'" ') | |
answer=$(echo $response | grep "OK") | |
# Cancel if unable | |
if [ ! "$answer" ] ; then | |
echo "Program closing User cancelled | |
Exit" | |
exit 012345 | |
fi | |
sudo mount -uw / | |
killall Finder | |
sudo trimforce disable | |
exit 0 | |
fi | |
# Action is user select Enable | |
if [ "$action" == "Enable" ] ; then | |
response=$(osascript -e 'tell app "System Events" to display dialog "Your Choice is Enable Trim Enabler Catalina\n\n" buttons {"Cancel","OK"} default button 2 with title "'"$apptitle"' '"$version"'" with icon POSIX file "'"$iconfile"'" ') | |
answer=$(echo $response | grep "OK") | |
# Cancel if unable | |
if [ ! "$answer" ] ; then | |
echo "Program closing User cancelled | |
Exit" | |
exit 012345 | |
fi | |
sudo mount -uw / | |
killall Finder | |
sudo trimforce enable | |
exit 0 | |
fi | |
# Cancel is user selects Cancel | |
if [ ! "$imagepath" ] ; then | |
echo "Program closing User cancelled | |
Exit" | |
exit 012345 | |
fi |
I use and test / Built the script with SIP Disable
I use and test / Built the script with SIP Disable
Oh, I got it. Thank you for your answer about SID Disable. This case I'm ok to ignore mount: / failed with 77 for MacOS is SIP Enable.
BR,
Jeans
Worked for me on 10.15.2.
Worked for me on 10.15.2.
Great!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No, I have no CoreStorage.
I list using diskutil cs list shows 2 external disks (no Macintosh HD in the list).