Skip to main content
Solved

Turn off Natural Scrolling using a script


Forum|alt.badge.img+1

Hello, I am new to jamf and our client is requesting that we automate turning off of Natural Scrolling. I have found a script that when run in terminal works perfect and does not prompt the user for anything. Currently this is what I am using:

#!bin\\bash

defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

When I go to run this through jamf it just fails and does nothing. I'm sure I am missing something but have racked my brain and cannot figure it out. Thanks in advance for the help.

Best answer by mdp

Testing this out myself, it seems you may have to run it as the user rather than running it as root (as Jamf scripts natively do). So you can try something like this:

#!/bin/bash loggedInUser=$(stat -f%Su /dev/console) loggedInUID=$(id -u $loggedInUser) /bin/launchctl asuser $loggedInUID sudo -iu $loggedInUser defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

 

View original
Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+8
  • Contributor
  • 37 replies
  • Answer
  • December 12, 2023

Testing this out myself, it seems you may have to run it as the user rather than running it as root (as Jamf scripts natively do). So you can try something like this:

#!/bin/bash loggedInUser=$(stat -f%Su /dev/console) loggedInUID=$(id -u $loggedInUser) /bin/launchctl asuser $loggedInUID sudo -iu $loggedInUser defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

 


Forum|alt.badge.img+2
  • New Contributor
  • 11 replies
  • December 12, 2023

Can not really say anything without knowing why script fails. but you can run as a command.

policy > Files and Processes then put 

defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings