Never used Castor Oil. Had a similar experience however with Magnesium Citrate.
I would say the solution is probably the same
Put a pillow in front of the toilet, and kneel at the toilet with your knees on the pillow.
With as little food in your stomach as possible drink some water at least 5-10 minutes before you kneel down.
Then take a stadium cup of ice water in one hand, and a bottle of Magnesium citrate in the other.
Take a sip of magnesium citrate, and immediately a sip of water. Then allow the bitter after taste to start to die down, and take another sip of water. Repeat until the magnesium citrate is all the way in.
Then stay there for 5-7 minutes just to be sure. Keep it down if you possibly can.
With Magnesium Citrate, I have found that if I strictly avoid the cherry flavor and get either the lemon or grape, the gag reflex is weaker and I can keep it down with some effort.
Try that with castor oil, and see if you get the same result.