We study in this paper Hida's p-adic Hecke algebra for GLn over a CM field F . Hida has made a conjecture about the dimension of these Hecke algebras, which he calls the non-abelian Leopoldt conjecture, and shown that his conjecture in the case F = Q implies the classical Leopoldt conjecture for a number field K of degree n over Q, if one assumes further the existence of automorphic induction of characters for the extension K/Q.We study Hida's conjecture using the automorphy lifting techniques adapted to the GLn setting by Calegari-Geraghty. We prove an automorphy lifting result in this setting, conditional on existence and local-global compatibility of Galois representations arising from torsion classes in the cohomology of the corresponding symmetric manifolds. Under the same conditions we show that one can deduce the classical (abelian) Leopoldt conjectures for a totally real number field K and a prime p using Hida's nonabelian Leopoldt conjecture for p-adic Hecke algebra for GLn over CM fields without needing to assume automorphic induction of characters for the extension K/Q. For this methods of potential automorphy results are used.to Mazur [Maz89] gives the expected dimension of these deformation rings, which in turn implies the formula (1.1) for the codimension of the cohomology as Λ-module.We take as our starting point the work of Calegari-Geraghty [CG] showing how to make the Taylor-Wiles method work in the 'positive defect' context, assuming the existence of Galois representations associated to torsion classes in the cohomology of the manifolds X U . Using similar methods, and a similar assumption about the existence of Galois representations, we prove an R = T theorem for Hida's ordinary completed cohomology groups.Assume now that U = v U v is a product. Let S be a finite set of finite places of F , containing the places dividing p, and such that for each v ∈ S, U v = GL n (O Fv ). Then the unramified Hecke algebraacts on the groups H * ord (U ), and we write T S ord (U ) for the quotient which acts faithfully. It is a finite Λ-algebra. One expects that for each maximal ideal m ⊂ T S ord (U ), there should exist a continuous semi-simple representation ρ m : G F,S → GL n (T S ord (U )/m) which is characterized uniquely up to isomorphism by a condition on the characteristic polynomials of Frobenius elements at finite places v ∈ S; this generalizes the well-known relation tr ρ(Frob p ) = a p (f ) satisfied by the Galois representations associated to elliptic modular forms by Deligne. If m is such a maximal ideal and ρ m is absolutely irreducible, then we say that m is non-Eisenstein. We in fact study the localized cohomology H * ord (U ) m , which is finite over Λ and a faithful T S ord (U ) m -module. (If F is an imaginary CM or totally real field, then the existence of ρ m can be deduced from recent work of Scholze [Sch].)We can now state a more precise version of Hida's conjecture:We think of this conjecture as a 'non-abelian analogue' of the classical Leopoldt conjecture. It is worth remarking that...