hc-05 avrdude errors (OSX platform)

I am working on a project and decided to buy a DSD Tech HC-05 Bluetooth module in order to upload code wirelessly to the arduino.

My Macbook Pro can pair with the HC-05 module but disconnects shortly after. I am able to successfully enter AT command mode and configure the required settings - like setting the module to be a master. However, when commands are configured using AT through the arduino serial port my Macbook Pro is no longer able to detect the HC-05 module.
The only way it can detect the HC-05 module again is if I write (AT+ORGL) in the AT commands which can be problematic as it resets the module configuration.

I am trying to upload a simple led light up example by using pin 8 connected to an led through a resistor. I upload the following code after selecting the correct port and processor :

#include <SoftwareSerial.h>
#define rxPin 2
#define txPin 3
#define baudrate 9600

SoftwareSerial hc05(rxPin ,txPin);

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);    
  hc05.begin(baudrate);

     pinMode(8,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(8,HIGH);
delay(100);
digitalWrite(8,LOW);
delay(100); 
}

When I use the Arduino Uno and select the corresponding port for the bluetooth module I receive the following error :

avrdude: ser_open(): can't open device "/dev/cu.H-C-2010-06-01-DevB": Resource busy
Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

When I use the Arduino Mega I receive the following error :
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
An error occurred while uploading the sketch

I would like to please ask if you can help me in any way as creating a bluetooth connection from my Macbook to the HC-05 is imperative for the success of the project. Can the fact that I am using a Macbook Pro be causing the problems ? Or should I just purchase a different module that is fully compatible with the Macbook Operating System , as I do not find purchasing another laptop feasible ?

Thank you for your help