Hacking Question Tinfoil USB install FROM OSX

Shadow147

Active Member
OP
Newcomer
Joined
Oct 1, 2018
Messages
37
Trophies
0
Age
34
XP
134
Country
China
Hi all!

So I am happily playing all the newly installed nsps on my switch (all small games), but there is one last thing I am having trouble with: installing the big nsps via tinfoil USB install, because I only have a mac.

I am running atmosphere 0.8.1, with FW 6.2.0, on a 200gb sd card formatted to fat32.

My macbook air is running OSX El Capitan 10.11.6.

I have installed libusb via terminal, have Python 3.7 and have downloaded the usb_install_pc.py file.

When I go into tinfoil usb install on my switch and connect it to my mac via usb, it says my usb is ready, but when I type the command 'python usb_install_pc.py <nsp location>' into terminal on my mac, I get various errors, most commonly '[Errno 20] Not a directory' or 'syntax error' or 'command not found'.

Nevercholt has a great youtube tutorial on the usb install, but nothing for Macs.

I have searched long and hard for any substantial information on this and am coming up very short. Would anybody be willing to provide any clear, step-by-step instructions on how to do this for an absolute novice ?

If we get a good process here that is easy for dinguses like me to understand, it could also become a really handy sticky for the forum too?

Let me know what you think guys! Also if you've spotted something blindingly obvious above that I'm missing, feel free to point that out too~
 

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
Hi all!

So I am happily playing all the newly installed nsps on my switch (all small games), but there is one last thing I am having trouble with: installing the big nsps via tinfoil USB install, because I only have a mac.

I am running atmosphere 0.8.1, with FW 6.2.0, on a 200gb sd card formatted to fat32.

My macbook air is running OSX El Capitan 10.11.6.

I have installed libusb via terminal, have Python 3.7 and have downloaded the usb_install_pc.py file.

When I go into tinfoil usb install on my switch and connect it to my mac via usb, it says my usb is ready, but when I type the command 'python usb_install_pc.py <nsp location>' into terminal on my mac, I get various errors, most commonly '[Errno 20] Not a directory' or 'syntax error' or 'command not found'.

Nevercholt has a great youtube tutorial on the usb install, but nothing for Macs.

I have searched long and hard for any substantial information on this and am coming up very short. Would anybody be willing to provide any clear, step-by-step instructions on how to do this for an absolute novice ?

If we get a good process here that is easy for dinguses like me to understand, it could also become a really handy sticky for the forum too?

Let me know what you think guys! Also if you've spotted something blindingly obvious above that I'm missing, feel free to point that out too~
I work the USB install on Mac just fine. Just to be clear, you're using python3 (not python2 which is pre-installed on Macs) and pointing the script to a DIRECTORY and not the actual NSP file, right?
Code:
python3 usb_install_pc.py "/Users/Username/Desktop/NSPs/"
 
  • Like
Reactions: achuk

Shadow147

Active Member
OP
Newcomer
Joined
Oct 1, 2018
Messages
37
Trophies
0
Age
34
XP
134
Country
China
I work the USB install on Mac just fine. Just to be clear, you're using python3 (not python2 which is pre-installed on Macs) and pointing the script to a DIRECTORY and not the actual NSP file, right?
Code:
python3 usb_install_pc.py "/Users/Username/Desktop/NSPs/"

Quick reply, thanks!

Yes indeed-- I didn't see anyone specifically mention directing to a directory and not a file but I had already tried this anyway-- it returns:

(null): can't open file 'usb_install_pc.py': [Errno 2] No such file or directory​
 

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
Quick reply, thanks!

Yes indeed-- I didn't see anyone specifically mention directing to a directory and not a file but I had already tried this anyway-- it returns:

(null): can't open file 'usb_install_pc.py': [Errno 2] No such file or directory​
This means the python script is not in the same directory that you're currently trying to run the script from (AKA, your Terminal is currently in your home directory but the script is in your Downloads folder).
 

crossholo

Well-Known Member
Newcomer
Joined
May 26, 2017
Messages
45
Trophies
0
Age
26
XP
963
Country
Italy
Quick reply, thanks!

Yes indeed-- I didn't see anyone specifically mention directing to a directory and not a file but I had already tried this anyway-- it returns:

(null): can't open file 'usb_install_pc.py': [Errno 2] No such file or directory​

you have to put the actual path of the usb_install_pc.py

like this:
Code:
python3 Users/Username/downloads/usb_install_pc.py /Users/Username/Desktop/NSPs

Let me know if it works because I got another (different) error later. It might be related to the fact that I only have usb-ports and I connect my switch with usbc to usb cables, but not completely sure.
To be specific, this is what I get:
Code:
Traceback (most recent call last):
  File "/Users/stefano/Desktop/usb_install_pc.py", line 137, in <module>
    raise ValueError('Switch is not found!')
ValueError: Switch is not found!
 
Last edited by crossholo,

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
For me, the script is in my Downloads folder so when I open Terminal I do this:
Code:
$ cd ~/Downloads/
$ python3 usb_install_pc.py "/Users/analogman/Downloads/NSPs"
And it works fine for me.
 

Shadow147

Active Member
OP
Newcomer
Joined
Oct 1, 2018
Messages
37
Trophies
0
Age
34
XP
134
Country
China
you have to put the actual path of the usb_install_pc.py

like this:
Code:
python3 Users/Username/downloads/usb_install_pc.py /Users/Username/Desktop/NSPs

Let me know if it works because I got another (different) error later

Yeah I've been trying this too-- tried it again and it returned:

File "/Users/<username>/Downloads/D/usb_install_pc.py", line 7

<!DOCTYPE html>

^

SyntaxError: invalid syntax
 

Shadow147

Active Member
OP
Newcomer
Joined
Oct 1, 2018
Messages
37
Trophies
0
Age
34
XP
134
Country
China

Attachments

  • Screen Shot 2018-12-15 at 10.22.13 PM.png
    Screen Shot 2018-12-15 at 10.22.13 PM.png
    2 KB · Views: 286

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
Hi all!

So I am happily playing all the newly installed nsps on my switch (all small games), but there is one last thing I am having trouble with: installing the big nsps via tinfoil USB install, because I only have a mac.

I am running atmosphere 0.8.1, with FW 6.2.0, on a 200gb sd card formatted to fat32.

My macbook air is running OSX El Capitan 10.11.6.

I have installed libusb via terminal, have Python 3.7 and have downloaded the usb_install_pc.py file.

When I go into tinfoil usb install on my switch and connect it to my mac via usb, it says my usb is ready, but when I type the command 'python usb_install_pc.py <nsp location>' into terminal on my mac, I get various errors, most commonly '[Errno 20] Not a directory' or 'syntax error' or 'command not found'.

Nevercholt has a great youtube tutorial on the usb install, but nothing for Macs.

I have searched long and hard for any substantial information on this and am coming up very short. Would anybody be willing to provide any clear, step-by-step instructions on how to do this for an absolute novice ?

If we get a good process here that is easy for dinguses like me to understand, it could also become a really handy sticky for the forum too?

Let me know what you think guys! Also if you've spotted something blindingly obvious above that I'm missing, feel free to point that out too~
Step-by-step:

  1. Install Brew (https://brew.sh)
    Code:
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Use Brew to install python3 and libusb
    Code:
    brew install python3 libusb
  3. Use python3's pip installer to install pyusb
    Code:
    pip3 install pyusb
  4. Download the usb_install_pc.py script (https://github.com/Adubbz/Tinfoil/raw/master/tools/usb_install_pc.py)
  5. Connect Switch and open TinFoil, choose USB Install
  6. Run script and point to a directory containing NSPs
    Code:
    python3 usb_install_pc.py "/path/to/NSPS/"
Also, if you actually LOOK at the python script, the instructions for MacOS are right at the top:
Code:
# macOS Instructions:
# 1. Install Homebrew https://brew.sh
# 2. Install Python 3
# sudo mkdir /usr/local/Frameworks
# sudo chown $(whoami) /usr/local/Frameworks
# brew install python
# 3. Install PyUSB
# pip3 install pyusb
# 4. Install libusb
# brew install libusb
# 5. Plug in your Switch and go to Tinfoil > Title Management > USB Install NSP
# 6. Run this script
# python3 usb_install_pc.py <path/to/nsp_folder>
 
Last edited by DocKlokMan,

Shadow147

Active Member
OP
Newcomer
Joined
Oct 1, 2018
Messages
37
Trophies
0
Age
34
XP
134
Country
China
Step-by-step:

  1. Install Brew (https://brew.sh)
    Code:
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Use Brew to install python3 and libusb
    Code:
    brew install python3 libusb
  3. Use python3's pip installer to install pyusb
    Code:
    pip3 install pyusb
  4. Download the usb_install_pc.py script (https://github.com/Adubbz/Tinfoil/raw/master/tools/usb_install_pc.py)
  5. Connect Switch and open TinFoil, choose USB Install
  6. Run script and point to a directory containing NSPs
    Code:
    python3 usb_install_pc.py "/path/to/NSPS/"
Also, if you actually LOOK at the python script, the instructions for MacOS are right at the top:
Code:
# macOS Instructions:
# 1. Install Homebrew https://brew.sh
# 2. Install Python 3
# sudo mkdir /usr/local/Frameworks
# sudo chown $(whoami) /usr/local/Frameworks
# brew install python
# 3. Install PyUSB
# pip3 install pyusb
# 4. Install libusb
# brew install libusb
# 5. Plug in your Switch and go to Tinfoil > Title Management > USB Install NSP
# 6. Run this script
# python3 usb_install_pc.py <path/to/nsp_folder>

Okay so I had already installed Homebrew ages ago so I went for it again and I got:


<username>-MacBook-Air:D <username>$ brew install python3 libusb

Updating Homebrew...

Warning: python 3.7.1 is already installed, it's just not linked

You can use `brew link python` to link this version.

Warning: libusb 1.0.22 is already installed and up-to-date

To reinstall 1.0.22, run `brew reinstall libusb`

<username>-MacBook-Air:D <username>$​

I'm assuming this would be a problem and I should run brew link python?
 

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
Okay so I had already installed Homebrew ages ago so I went for it again and I got:


<username>-MacBook-Air:D <username>$ brew install python3 libusb

Updating Homebrew...

Warning: python 3.7.1 is already installed, it's just not linked

You can use `brew link python` to link this version.

Warning: libusb 1.0.22 is already installed and up-to-date

To reinstall 1.0.22, run `brew reinstall libusb`

<username>-MacBook-Air:D <username>$​

I'm assuming this would be a problem and I should run brew link python?
Meh, if it works then you don't need to mess with it, but if you want
Code:
brew link --overwrite python3
 

Shadow147

Active Member
OP
Newcomer
Joined
Oct 1, 2018
Messages
37
Trophies
0
Age
34
XP
134
Country
China
Meh, if it works then you don't need to mess with it, but if you want
Code:
brew link --overwrite python3

Okay so now when running ‘python3 <path to script file> <path to nsp folder>’, it starts working, and I select the nsp in tinfoil, and then the Switch says:

“Installing <nsp>

Retrieving remote NSP header..”​

But Terminal says:

“kages/usb/backend/libusb1.py", line 595, in _check

raise USBError(_strerror(ret), ret, _libusb_errno[ret])

usb.core.USBError: [Errno 84] Overflow”​
 

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
Okay so now when running ‘python3 <path to script file> <path to nsp folder>’, it starts working, and I select the nsp in tinfoil, and then the Switch says:

“Installing <nsp>

Retrieving remote NSP header..”​

But Terminal says:

“kages/usb/backend/libusb1.py", line 595, in _check

raise USBError(_strerror(ret), ret, _libusb_errno[ret])

usb.core.USBError: [Errno 84] Overflow”​
That one's new to me. Try reinstalling pyusb.
Code:
pip3 install --force-reinstall pyusb
 

Shadow147

Active Member
OP
Newcomer
Joined
Oct 1, 2018
Messages
37
Trophies
0
Age
34
XP
134
Country
China
That one's new to me. Try reinstalling pyusb.
Code:
pip3 install --force-reinstall pyusb

Hmm!

A permissions issue for some reason??

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyusb-1.0.2-py3.7.egg-info/dependency_links.txt'

Consider using the `--user` option or check the permissions.​

The plot thickens
 

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
Hmm!

A permissions issue for some reason??

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pyusb-1.0.2-py3.7.egg-info/dependency_links.txt'

Consider using the `--user` option or check the permissions.​

The plot thickens
You mentioned that you installed Brew and python3 ages ago. Was it prior to macOS 10.12? Because of so they had to change the directories that casks were installed in. Looks like your python3 install was from before that change and now you don't have access to that folder. Try this:
Code:
sudo chown $(whoami) /Library/Frameworks
And then try to reinstall pyusb again.
 

Shadow147

Active Member
OP
Newcomer
Joined
Oct 1, 2018
Messages
37
Trophies
0
Age
34
XP
134
Country
China
You mentioned that you installed Brew and python3 ages ago. Was it prior to macOS 10.12? Because of so they had to change the directories that casks were installed in. Looks like your python3 install was from before that change and now you don't have access to that folder. Try this:
Code:
sudo chown $(whoami) /Library/Frameworks
And then try to reinstall pyusb again.

I get:

Requirement already satisfied: pyusb in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.0.2)​

When trying to install pyusb after that.
 

DocKlokMan

Plugin Dev
Member
Joined
Apr 20, 2007
Messages
3,009
Trophies
2
Age
36
XP
4,571
Country
United States
I get:

Requirement already satisfied: pyusb in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (1.0.2)​

When trying to install pyusb after that.
You used the force-reinstall option? If so, try the script now, see what happens.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    OctoAori20 @ OctoAori20: Nice nice-