Note the location of the studs in the wall using a stud finder and a pencil. Mark the studs at the level of the bed installation and up to 4 feet higher.
Position the bed at the desired height and position with the help of assistants, setting the long side of the bed against the wall, bunk style. Position four hinges between the wall and the bed in positions where they lie on studs, halfwat on the frame and halfway on the wall with their centers facing upwards. Mark the location of the hinge screws in the wall and on the bed frame.
Bring the bed down and drill out each marking on the frame using a drill. Set the hinge in place over the holes in the frame, with the center of the hinge facing up. Screw the hinges to the frame using 2-inch wood screws. Pass the screws through the hinges and into the holes in the frame before tightening them securely.
Drill a hole into the opposite corners of the bed, on top of the bed frame on the side opposite the wall. Set a 1-inch eyehook into each hole and tighten securely until the head of the hook is touching the wood. Set a 1-inch carabiner in the hook. Attach one end of a 4-foot length of chain to the carabiner and lock it shut.
Drill a hole in the wall at the head and foot of the bed, over a stud, at a position that is 3 feet higher than the bed. Screw a 1-inch eyehook into the hole until the hook is flush with the wall. Set a 1-inch carabiner in the hook.
Hold the bed in position with assistants and attach the other end of the chains to the carabiners on the wall. Screw the bed frame hinges to the wall using 3-inch wood screws in the predrilled holes. Adjust the tension on the chain lengths by raising or lowering each chain attachment by the necessary amount of links.
Drill a hole into a stud directly level with the center of the long side of the bed frame when it is in its folded position. Drill a corresponding hole into the center of the bed frame near the other hole. Screw 1-inch eyehooks into each hole. Fasten the two eyehooks together with a 3-inch climbing carabiner to store the bed in the folded position.