Can't upload Marlin2.0 to Ender 3

I have bee trying to install my BLTouch on my Ender 3. I have gotten through all the hardware with no issue, and I am now trying to install configured Marlin to my printer.

I already have the boot loader on there, so I skipped that step. After I had configured the files, I downloaded the Sanguino boards, like many tutorials show.
After clicking verify, with the Sanguino board and the processor being ATmega1284(P) (16MHZ), I waited for it to compile. I got an error like I should, but it wasn't what I expected. The error is very long, so I put you can view it in a pastebin
It seems a very common occurrence in the error is:

#error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'"

Also, according to how to install Marlin using the Arduino IDE, the board should be 'Arduino/Genuino Mega or Mega 2560'.
When I selected this board, and then compiled the code, it didn't error, instead saying:

Sketch uses 66548 bytes (26%) of program storage space. Maximum is 253952 bytes.
Global variables use 2686 bytes (32%) of dynamic memory, leaving 5506 bytes for local variables. Maximum is 8192 bytes.

Now, I'm not sure about you but 66548 bytes seems a little low, even if I took off only 9000 bytes 9(In videos it's around 130000 bytes).
Either way, I continued and uploaded to to my printer, and this is the output:

Sketch uses 66548 bytes (26%) of program storage space. Maximum is 253952 bytes.
Global variables use 2686 bytes (32%) of dynamic memory, leaving 5506 bytes for local variables. Maximum is 8192 bytes.
/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -patmega2560 -cwiring -P/dev/cu.usbserial-AK064J28 -b115200 -D -Uflash:w:/var/folders/nv/3rvpqg7n2h37snbb2cf6pf280000gq/T/arduino_build_997162/Marlin.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
         User configuration file is "/Users/everyone/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbserial-AK064J28
         Using Programmer              : wiring
         Overriding Baud Rate          : 115200
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer

avrdude done.  Thank you.

An error occurred while uploading the sketch

What is the issue here?

I've just tried re-adding a boot loader to the printer, but that hasn't helped; I still can't upload firmware.

Since my printer is now bricked, and help would be appreciated!

I've tried again...
This time I downloaded the TH3D install because it comes with both the correct version of the Arduino IDE (1.8.7) and the correct Sanguino board.
I went ahead and burnt the boot loader again, then tried to install marlin, while the Sanguino board was selected. I didn't get a huge error, but I got one nonetheless:

Build options changed, rebuilding all
fork/exec /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++: resource temporarily unavailable
In file included from sketch/src/HAL/AVR/../../inc/../pins/pins.h:71:0,
                 from sketch/src/HAL/AVR/../../inc/MarlinConfig.h:32,
                 from sketch/src/HAL/AVR/watchdog.cpp:25:
sketch/src/HAL/AVR/../../inc/../pins/ramps/pins_RAMPS.h:56:6: error: #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'"
     #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'"
      ^
Error compiling for board Sanguino 1284p.

Trying it with the Mega selected produces:

Build options changed, rebuilding all
fork/exec /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++: resource temporarily unavailable
Error compiling for board Arduino Mega 2560.

I managed to install the TH3D firmware fine, but I still want to know why I can't install vanilla Marlin. I can only assume it's some issue with the size of the firmware. There's no way Marlin is only 66548 bytes.

DreamingInsanity:

     #error "Oops! Select 'Arduino/Genuino Mega or Mega 2560' in 'Tools > Board.'"

This is probably caused by you not having Marlin configured correctly. You need to edit Configuration.h and maybe Configuration_adv.h to make it work with the ATmega1284P on your Ender 3 board. You should be able to find guidance on doing that, since this is probably a common thing for Ender 3 owners to do. You don't have any hope of uploading to an ATmega1284P with Arduino Mega 2560 selected, since that uses a different microcontroller.

DreamingInsanity:
fork/exec /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++: resource temporarily unavailable

This is more tricky. My research indicates it is caused by having too many processes running. The Marlin firmware has hundreds of files, so compilation of that firmware is pretty resource intensive.

I would recommend trying Arduino IDE 1.8.12, since the Arduino developers are always working on improving the software and it's possible the efficiency has improved since the outdated Arduino IDE 1.8.7.

I would recommend making sure you have the least number of other programs running when you are compiling Marlin, in case they are generating processes that contribute to you hitting the limit. You should restart your computer.

You can also have a try at the recommendation here:

That's for Linux, but I believe it will also apply to macOS.

pert:
This is probably caused by you not having Marlin configured correctly. You need to edit Configuration.h and maybe Configuration_adv.h to make it work with the ATmega1284P on your Ender 3 board. You should be able to find guidance on doing that, since this is probably a common thing for Ender 3 owners to do. You don't have any hope of uploading to an ATmega1284P with Arduino Mega 2560 selected, since that uses a different microcontroller.

The problem was that I didn't configure for Ender 3. I was following a teaching tech guide but he uses Marlin 1.1, so I guess configuring for Ender 3 isn't needed (or he'd already done what I did below)
Either way, I got it working by just downloading the Marlin config files that were already set up for Ender 3, and after changing everything, it compiled using Sanguino fine.
This seemed to get rid of the 'resource temporarily unavailable' error as well.

I was able to successfully upload it so thank you!

I'm glad to hear you found a solution. Enjoy!