Skip to main content
Changed script based on feedback.
Source Link

I am running the following script in Platypus and getting errorsbut the MAC address does not change:

#!/bin/zsh

IF=en7
export PATH=”$PATH:/sbin:/usr/bin”

mac=`ifconfig $IF | grep ether | awk '/ether/{print $2}’`'`
echo “$IF"$IF mac before change=$mac”change=$mac"
randmac=`openssl rand -hex 6 | sed ‘s's/\(..\)/\1:/g; s/.$//’`'`
sudo ifconfig $IF ether $randmac
mac=`ifconfig $IF | grep ether | awk '/ether/{print $2}’`'`
echo “$IF"$IF mac after change=$mac”change=$mac"

Errors I receive:

​/Applications/MAC Randomizer.app/Contents/Resources/script:6: command not found: grep /Applications/MAC Randomizer.app/Contents/Resources/script:6: command not found: awk
“en7 mac before change=”
/Applications/MAC Randomizer.app/Contents/Resources/script:8: command not found: openssl
/Applications/MAC Randomizer.app/Contents/Resources/script:8: command not found: sed
/Applications/MAC Randomizer.app/Contents/Resources/script:8: no such file or directory: s/.$//\M-b\M-^@\M-^Y
/Applications/MAC RandomizerNot receiving errors anymore.app/Contents/Resources/script:9: command However, the MAC address is not found: sudo
/Applications/MAC Randomizerchanged by the script.app/Contents/Resources/script:10: command Commands work individually pasted into Terminal, but not found: grep
/Applications/MAC Randomizerexecuted as an application by Platypus.app/Contents/Resources/script:10: command not found: awk
“en7 mac after change=”

Platypus screenshot:

Platypus screenshot

I am running the following script in Platypus and getting errors:

#!/bin/zsh

IF=en7
export PATH=”$PATH:/sbin:/usr/bin”

mac=`ifconfig $IF | grep ether | awk {print $2}’`
echo “$IF mac before change=$mac”
randmac=`openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’`
sudo ifconfig $IF ether $randmac
mac=`ifconfig $IF | grep ether | awk {print $2}’`
echo “$IF mac after change=$mac”

Errors I receive:

​/Applications/MAC Randomizer.app/Contents/Resources/script:6: command not found: grep /Applications/MAC Randomizer.app/Contents/Resources/script:6: command not found: awk
“en7 mac before change=”
/Applications/MAC Randomizer.app/Contents/Resources/script:8: command not found: openssl
/Applications/MAC Randomizer.app/Contents/Resources/script:8: command not found: sed
/Applications/MAC Randomizer.app/Contents/Resources/script:8: no such file or directory: s/.$//\M-b\M-^@\M-^Y
/Applications/MAC Randomizer.app/Contents/Resources/script:9: command not found: sudo
/Applications/MAC Randomizer.app/Contents/Resources/script:10: command not found: grep
/Applications/MAC Randomizer.app/Contents/Resources/script:10: command not found: awk
“en7 mac after change=”

Platypus screenshot:

Platypus screenshot

I am running the following script in Platypus but the MAC address does not change:

#!/bin/zsh

IF=en7

mac=`ifconfig $IF | awk '/ether/{print $2}'`
echo "$IF mac before change=$mac"
randmac=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'`
sudo ifconfig $IF ether $randmac
mac=`ifconfig $IF | awk '/ether/{print $2}'`
echo "$IF mac after change=$mac"

Not receiving errors anymore. However, the MAC address is not changed by the script. Commands work individually pasted into Terminal, but not executed as an application by Platypus.

Platypus screenshot:

Platypus screenshot

added 821 characters in body
Source Link

Randomize MAC Address Using ZSH and AppleScriptPlatypus

I do not know anything about AppleScript. I need some help creating aam running the following script in Platypus and then attaching it to an icon so I can run it from the Dock. My terminal is ZSHgetting errors:

#!/bin/bashzsh

IF=en0IF=en7
export PATH=”$PATH:/sbin:/usr/bin”

mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac before change=$mac”
randmac=`openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’`
sudo ifconfig $IF ether $randmac
mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac after change=$mac”

Errors I receive:

​/Applications/MAC Randomizer.app/Contents/Resources/script:6: command not found: grep /Applications/MAC Randomizer.app/Contents/Resources/script:6: command not found: awk
“en7 mac before change=”
/Applications/MAC Randomizer.app/Contents/Resources/script:8: command not found: openssl
/Applications/MAC Randomizer.app/Contents/Resources/script:8: command not found: sed
/Applications/MAC Randomizer.app/Contents/Resources/script:8: no such file or directory: s/.$//\M-b\M-^@\M-^Y
/Applications/MAC Randomizer.app/Contents/Resources/script:9: command not found: sudo
/Applications/MAC Randomizer.app/Contents/Resources/script:10: command not found: grep
/Applications/MAC Randomizer.app/Contents/Resources/script:10: command not found: awk
“en7 mac after change=”

Platypus screenshot:

Platypus screenshot

Randomize MAC Address Using ZSH and AppleScript

I do not know anything about AppleScript. I need some help creating a script and then attaching it to an icon so I can run it from the Dock. My terminal is ZSH:

#!/bin/bash

IF=en0
export PATH=”$PATH:/sbin:/usr/bin”

mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac before change=$mac”
randmac=`openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’`
sudo ifconfig $IF ether $randmac
mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac after change=$mac”

Randomize MAC Address Using Platypus

I am running the following script in Platypus and getting errors:

#!/bin/zsh

IF=en7
export PATH=”$PATH:/sbin:/usr/bin”

mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac before change=$mac”
randmac=`openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’`
sudo ifconfig $IF ether $randmac
mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac after change=$mac”

Errors I receive:

​/Applications/MAC Randomizer.app/Contents/Resources/script:6: command not found: grep /Applications/MAC Randomizer.app/Contents/Resources/script:6: command not found: awk
“en7 mac before change=”
/Applications/MAC Randomizer.app/Contents/Resources/script:8: command not found: openssl
/Applications/MAC Randomizer.app/Contents/Resources/script:8: command not found: sed
/Applications/MAC Randomizer.app/Contents/Resources/script:8: no such file or directory: s/.$//\M-b\M-^@\M-^Y
/Applications/MAC Randomizer.app/Contents/Resources/script:9: command not found: sudo
/Applications/MAC Randomizer.app/Contents/Resources/script:10: command not found: grep
/Applications/MAC Randomizer.app/Contents/Resources/script:10: command not found: awk
“en7 mac after change=”

Platypus screenshot:

Platypus screenshot

Post Closed as "Duplicate" by Graham Miln, user3439894, Nimesh Neema, mmmmmm, Allan

I do not know anything about AppleScript. I need some help creating a script and then attaching it to an icon so I can run it from the Dock. My terminal is ZSH:

#!/bin/bash

IF=en0 export PATH=”$PATH:/sbin:/usr/bin”

mac=ifconfig $IF | grep ether | awk ‘{print $2}’ echo “$IF mac before change=$mac” randmac=openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’ sudo ifconfig $IF ether $randmac mac=ifconfig $IF | grep ether | awk ‘{print $2}’ echo “$IF mac after change=$mac”

#!/bin/bash

IF=en0
export PATH=”$PATH:/sbin:/usr/bin”

mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac before change=$mac”
randmac=`openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’`
sudo ifconfig $IF ether $randmac
mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac after change=$mac”

I do not know anything about AppleScript. I need some help creating a script and then attaching it to an icon so I can run it from the Dock. My terminal is ZSH:

#!/bin/bash

IF=en0 export PATH=”$PATH:/sbin:/usr/bin”

mac=ifconfig $IF | grep ether | awk ‘{print $2}’ echo “$IF mac before change=$mac” randmac=openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’ sudo ifconfig $IF ether $randmac mac=ifconfig $IF | grep ether | awk ‘{print $2}’ echo “$IF mac after change=$mac”

I do not know anything about AppleScript. I need some help creating a script and then attaching it to an icon so I can run it from the Dock. My terminal is ZSH:

#!/bin/bash

IF=en0
export PATH=”$PATH:/sbin:/usr/bin”

mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac before change=$mac”
randmac=`openssl rand -hex 6 | sed ‘s/\(..\)/\1:/g; s/.$//’`
sudo ifconfig $IF ether $randmac
mac=`ifconfig $IF | grep ether | awk ‘{print $2}’`
echo “$IF mac after change=$mac”
Source Link
Loading