Skip to main content
Question

Alias app rename (python) via Jamf Console


Forum|alt.badge.img+2

Hey fellow Jamf users,

 

This is probably a very easy question, however its pulling my hair out,

 

Running the below command for instance to add an alias for Python works when ran us the user in terminal.

 

alias python='/usr/bin/python3'

 

Running this same command within Jamf as a script fails to change anything, I believe this is because it needs to be run as the logged in user,

 

To accomplish this I have the following which doesn't seem to do anything as well.

loggedInUser=$(stat -f%Su /dev/console)
su "$loggedInUser" -c 'alias python=/usr/local/bin/python3'

 

Any help will be great appreciated !

2 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • August 5, 2022

 

#!/bin/zsh logged_in_user=$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | /usr/bin/awk '/Name :/ && ! /loginwindow/ {print $3}') logged_in_uid=$(/usr/bin/id -u "$logged_in_user") /bin/launchctl asuser "$logged_in_uid" /usr/bin/sudo -iu "$logged_in_user" alias python=/usr/local/bin/python3

 


Forum|alt.badge.img+2
  • Author
  • New Contributor
  • 1 reply
  • August 5, 2022
mm2270 wrote:

 

#!/bin/zsh logged_in_user=$(/usr/sbin/scutil <<< "show State:/Users/ConsoleUser" | /usr/bin/awk '/Name :/ && ! /loginwindow/ {print $3}') logged_in_uid=$(/usr/bin/id -u "$logged_in_user") /bin/launchctl asuser "$logged_in_uid" /usr/bin/sudo -iu "$logged_in_user" alias python=/usr/local/bin/python3

 


Thanks for your prompt reply, it executes this script with no errors, however it still fails to attach the alias to python3 :(

 

any other ideas ?


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