Born into a naval family, Macnamara served in the East Indies during the last years of the American War of Independence, seeing action with Hughes at the Battle of Cuddalore. He received the acting rank of lieutenant during this time, but reverted to midshipman afterwards. He returned to naval service during the Spanish and Russian armaments, and was serving with Lord Hood aboard HMS Victory on the outbreak of the French Revolutionary Wars. He saw action in the Mediterranean and was eventually promoted to his own commands. He achieved success as a daring frigate captain, serving with Nelson and making several hard-fought captures. He finished his service in the Mediterranean with action at the Battle of Cape St Vincent, and later served in the West Indies before the Peace of Amiens.
Macnamara found himself in trouble with the law after killing a man in a duel, but summoned a bevy of naval officers to testify in his defence, and was acquitted. He commanded a number of ships of the line in the following years, in the Baltic, North Sea and off of the French coast. He was promoted to rear-admiral in 1814, but did not receive a seagoing command. He married in 1818 and died in 1826, having served with prominent naval officers like Hood, Jervis and Nelson in a long and distinguished career.
Macnamara was born into a naval family in 1768 in County Clare, and entered the navy in 1782 aboard the 80-gun HMS Gibraltar. Gibraltar went out that year to the East Indies, flying the broad pennant of Commodore Sir Richard Bickerton. On his arrival he was transferred to the 74-gun HMS Superb, the flagship of the station commander, Sir Edward Hughes. Macnamara saw action at the Battle of Cuddalore on 20 June 1783 against M. de Suffren, in which battle Superb sustained losses of 12 men killed and 41 wounded. He was then given an acting rank of lieutenant aboard the 68-gun HMS Monarca and returned to England with her. He then reverted to the rank of midshipman and served aboard the 50-gun HMS Europa at Jamaica. Europa was at the time the flagship of Admiral Alexander Innes. After some years in this position, he received his lieutenant's commission on 1 December 1788 and went on to serve during the Spanish armament in 1789 and the Russian armament in 1791. He was first aboard the 74-gun HMS Excellent under Captain John Gell, later following him to the 100-gun HMS Victory, flying the flag of Admiral Lord Hood.
Macnamara continued to serve with Hood aboard Victory after the outbreak of war with Revolutionary France in 1793. He took part in the occupation of Toulon and was promoted by Hood to the rank of master and commander on 22 October 1793, at about the time of the evacuation of the port. He was appointed acting captain of the 74-gun HMS Bombay Castle, followed by the 32-gun HMS Southampton. Despite these commands an official mistake meant that his commission as post captain was dated 6 October 1795. Southampton was assigned to a squadron commanded by Commodore Horatio Nelson, supporting the Austrian army in Genoa.
Macnamara they spent 15 days in September 1795 blockading a French grain convoy in the port of Genoa. The convoy was protected by two frigates, the Vestale and the Brun. The French finally came out on the evening of the fifteenth day, and were engaged by Southampton, despite the French possessing considerably more firepower. After a sustained engagement Southampton forced Vestale to strike her colours while the Brun escaped with the convoy, leaving Vestale to her fate. But as Southampton prepared to lower her boats to take possession of the French ship, her fore-mast, which had been damaged during the engagement, went by the board. Taking advantage of this, Vestale raised her colours and escaped from the scene.
Macnamara had another chance to distinguish himself, when on 9 June 1796 a French corvette was sighted entering Hyères bay, and Vice-Admiral Sir John Jervis, commander of the Mediterranean Fleet, summoned Macnamara to his flagship, HMS Victory. He asked Macnamara to bring out the French ship if he could. Recognising the difficulty and risk that would be involved, he did not make it a formal written order, instead instructing Macnamara 'bring out the enemy's ship if you can; I'll give you no written order; but I direct you to take care of the king's ship under your command.' Macnamara promptly took his ship in under the guns of the batteries, and apparently having been mistaken for a French or neutral frigate, closed to within pistol shot of the French ship, and demanded her captain surrender. The captain replied with a broadside, and Macnamara brought Southampton alongside and sent his first lieutenant, Charles Lydiard, over in command of the boarders. After subduing fierce resistance Lydiard took possession of the French ship and together he and Macnamara escaped out to sea under heavy fire from the French shore batteries. Macnamara reported his triumph to Jervis
Sir, in obedience to the orders I received from you on the Victory's quarter-deck last evening, I pushed through the Grande Passe, and hauled up under the batteries on the N.E. of Porguerol with an easy sail, in hopes that I should be taken for a French or neutral frigate, which I have great reason to believe succeeded, as I got within pistol-shot of the enemy's ship before I was discovered, and cautioned the Captain through a trumpet not to make a fruitless resistance, when he immediately snapped his pistol at me, and fired a broadside. At this period, being very near the heavy battery of Fort Breganson, I laid him instantly onboard, and Lieutenant Lydiard, at the head of the boarders, with an intrepidity that no words can describe entered and carried her in about ten minutes, although he met with a spirited resistance from the captain (who fell) and a hundred men under arms to receive him ... After lashing the two ships together, I found some difficulty in getting from under the battery, which kept up a very heavy fire, and was not able to return through the Grande Passe before half after one o'clock this morning...
The prize, a 24-gun corvette named Utile, was taken into service with the Royal Navy as HMS Utile and Lydiard was promoted and given command of her, a commission confirmed on 22 July 1796. Macnamara's later service with Nelson included the capture of Portoferraio, the evacuations of Caprera and Corsica, and expeditions against Piombino and Castiglione. Macnamara had already developed a reputation for intrepidity bordering on recklessness, and he displayed these qualities again in an attack on the 18-gun Spanish brig Corso in a strong gale under enemy shore batteries. The first attempt to capture her failed, with only one man, the coxswain, getting on board. Macnamara tried again, managing to place 30 men aboard the Spanish ship, at which she surrendered. Having done so the weather prevented any further attempt to make contact with the prize. One of Macnamara's last acts in support of the Mediterranean Fleet was to take part in the Battle of Cape St Vincent on 14 February 1797, in which Southampton formed part of the centre of the line as a repeating frigate.
Southampton returned to Britain within a few months of the battle, and Macnamara was appointed to command the 32-gun HMS Cerberus, initially on the Irish station. During his time there he captured the 10-gun French privateer Echange, and on 20 October 1799 came across a convoy of Spanish merchantmen escorted by five frigates and two brigs. Despite the enemy's numerical superiority Macnamara attacked and captured one of the frigates, but was forced to abandon his prize after the other Spanish frigates came to her defence. He also captured a merchant ship, and having taken her men off, burnt her. Cerberus sustained minor damage during the engagement, and had only four men wounded. The Admiralty showed their approval of Macnamara's actions by promoting his first lieutenant. Macnamara was then sent out to the West Indies, where he cruised off Jamaica and San Domingo until the Peace of Amiens. Cerberus was then paid off in February 1803, and Macnamara went ashore.
While ashore during the peace Macnamara contrived to become embroiled in a duel. While walking his Newfoundland dog in Hyde Park on 6 April 1803 he had an altercation with Colonel Robert Montgomery, when their dogs began fighting. Harsh words were exchanged, and the two parties fought a duel that evening at Chalk Farm. Both men were wounded, the colonel mortally. Macnamara was arrested on a charge of manslaughter and put on trial at the Old Bailey on 22 April. Macnamara defended himself from the charge on the grounds that he had received an affront and that it was necessary for him to challenge it in order to maintain his position as a naval officer. He summoned many of his naval friends, among whom Viscounts Hood and Nelson, Lord Hotham, Sir Hyde Parker, Sir Thomas Troubridge, Captains Martin, Towry, Lydiard, Moore and Waller; and General Churchill and Lord Minto, to testify in his defence. They supported his assertion that he was the 'reverse of quarrelsome' and the jury took ten minutes to acquit him.
Macnamara returned to service with the resumption of the wars with France and took command of the 64-gun HMS Dictator in June 1805 for service in the North Sea. He commanded her for two years on this station before taking command of the 74-gun HMS Edgar. Macnamara served with the Baltic Fleet under Sir Richard Goodwin Keats in the Great Belt in 1808. During this service he took command of a squadron of gunboats and attacked a Danish brig and cutter off Nyborg. In a fierce attack, in which seven Danes were killed and thirteen wounded to one British officer killed and two seamen wounded; both Danish ships were captured. They were found to be the 18-gun Fama and the 12-gun Salorman. Macnamara was then appointed to the 74-gun HMS Berwick in 1809. This service took him back to the North Sea and then the coast of France. While commanding a small squadron blockading Cherbourg on 24 March 1811, he chased the French frigate Amazone off Barfleur, attacking the French ship and forcing her crew to abandon and burn her.
Macnamara was promoted to rear-admiral on 4 June 1814, but never had an active command. He married Henrietta, the widow of Lieutenant-Colonel the Hon. George Carleton, on 26 January 1818. Rear-Admiral James Macnamara died at Clifton, Bristol, on 15 January 1826 at the age of 57.